/* =========================================================
   dashboard.css — CRM custom styles (complements Tailwind CDN)
   ========================================================= */

:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --header-height: 64px;
    --brand-purple:      #5D4EE3;
    --brand-purple-dark: #4A3EBE;
    --brand-text-dark:   #2D2B52;
    --brand-text-light:  #6B7280;
    --brand-gray-bg:     #F8F9FB;
    --border-color:      #F0F0F5;
}

/* ---- Reset box-sizing ---- */
*, *::before, *::after { box-sizing: border-box; }

/* =========================================================
   LAYOUT
   ========================================================= */

.dashboard-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--brand-gray-bg);
    font-family: 'Outfit', sans-serif;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: #fff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.22s ease;
    overflow: hidden;
    z-index: 20;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Desktop: show collapse toggle */
.sidebar-collapse-btn {
    display: flex !important;
}

/* Desktop: hide the mobile hamburger */
.sidebar-toggle {
    display: none !important;
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */

.main-content {
    flex: 1;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* =========================================================
   HEADER
   ========================================================= */

.dash-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

/* =========================================================
   SIDEBAR NAV LINKS
   ========================================================= */

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--brand-text-light);
    text-align: left;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav-link:hover {
    background: #F5F3FF;
    color: var(--brand-purple);
}

.sidebar-nav-link.active {
    background: #EDE9FF;
    color: var(--brand-purple);
    font-weight: 600;
}

/* =========================================================
   LOGIN
   ========================================================= */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2D2B52 0%, #5D4EE3 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(45, 43, 82, 0.25);
}

/* =========================================================
   FORM ELEMENTS
   ========================================================= */

.dash-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-text-dark);
    margin-bottom: 6px;
}

.dash-input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: var(--brand-text-dark);
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dash-input:focus {
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px rgba(93, 78, 227, 0.12);
}

.dash-input::placeholder {
    color: #9CA3AF;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    background: var(--brand-purple);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--brand-purple-dark);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    background: #F3F4F6;
    color: var(--brand-text-dark);
    border: none;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.btn-secondary:hover {
    background: #E5E7EB;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    background: #FEE2E2;
    color: #DC2626;
    border: none;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.btn-danger:hover {
    background: #FECACA;
}

/* =========================================================
   TABLE
   ========================================================= */

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-family: 'Outfit', sans-serif;
}

.dash-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand-text-light);
    background: var(--brand-gray-bg);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.dash-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #F5F5F8;
    color: var(--brand-text-dark);
    vertical-align: middle;
}

.dash-table tr:last-child td {
    border-bottom: none;
}

.dash-table tbody tr:hover {
    background: #FAFAFA;
}

/* =========================================================
   STAT CARDS
   ========================================================= */

.stat-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #F3F4F6;
    padding: 20px 24px;
}

/* =========================================================
   HOME GRID (2-col layout for recent panels)
   ========================================================= */

.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* =========================================================
   STATUS BADGES
   ========================================================= */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    white-space: nowrap;
}

/* Quote / lead statuses */
.badge-draft      { background: #F3F4F6; color: #6B7280; }
.badge-new        { background: #EDE9FF; color: #5D4EE3; }
.badge-sent       { background: #DBEAFE; color: #1D4ED8; }
.badge-contacted  { background: #DBEAFE; color: #1D4ED8; }
.badge-accepted   { background: #DCFCE7; color: #15803D; }
.badge-converted  { background: #DCFCE7; color: #15803D; }
.badge-cancelled  { background: #FEE2E2; color: #DC2626; }
.badge-lost       { background: #F3F4F6; color: #6B7280; }

/* Client statuses */
.badge-prospect   { background: #EDE9FF; color: #5D4EE3; }
.badge-active     { background: #DCFCE7; color: #15803D; }
.badge-inactive   { background: #F3F4F6; color: #6B7280; }

/* Package badges */
.badge-pkg-essential  { background: #CCFBF1; color: #0F766E; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.badge-pkg-accelerate { background: #EDE9FF; color: #5D4EE3; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.badge-pkg-scaleup    { background: #DCFCE7; color: #15803D; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; display: inline-block; }

/* =========================================================
   TABLE SCROLL WRAPPER
   ========================================================= */

.table-scroll-wrapper {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #F3F4F6;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* =========================================================
   MODALS
   ========================================================= */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: #fff;
    border-radius: 20px;
    max-width: 520px;
    width: 92%;
    max-height: 82vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
}

/* =========================================================
   MOBILE  (≤ 768px)
   ========================================================= */

@media (max-width: 768px) {
    /* Show hamburger, hide desktop collapse btn */
    .sidebar-toggle {
        display: flex !important;
    }

    .sidebar-collapse-btn {
        display: none !important;
    }

    /* Off-canvas sidebar */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: var(--sidebar-width) !important;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
    }

    .login-card {
        padding: 28px 20px;
    }
}
