/* ============================================================================
   TDD Portal — Main Stylesheet
   Branding: TrueDentalDiscounts.com color palette
   ============================================================================ */

:root {
    --tdd-primary: #526AF4;
    --tdd-dark-blue: #0C72B1;
    --tdd-green: #3AB54A;
    --tdd-orange: #F9A61A;
    --tdd-red: #E74C3C;
    --tdd-yellow: #FDE428;
    --tdd-dark: #1C2833;
    --tdd-light-gray: #F4F6F9;
    --tdd-med-gray: #D5D8DC;
    --tdd-accent-blue: #E1EBF7;
    --tdd-accent-green: #E4F0D5;

    --sidebar-width: 260px;
    --topbar-height: 60px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--tdd-light-gray);
    color: var(--tdd-dark);
    margin: 0;
    min-height: 100vh;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, var(--tdd-dark-blue) 0%, #0a5f94 100%);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    height: 36px;
    width: auto;
}

.sidebar-brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    list-style: none;
    padding: 0.75rem 0;
    margin: 0;
}

.sidebar-item { margin: 0; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-left-color: rgba(255,255,255,0.3);
}

.sidebar-link.active {
    color: #fff;
    background: rgba(82, 106, 244, 0.25);
    border-left-color: var(--tdd-primary);
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-divider {
    margin: 0.5rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-heading {
    padding: 0.5rem 1.25rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
}

/* ============================================================================
   TOP BAR
   ============================================================================ */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--tdd-med-gray);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-user {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--tdd-dark);
}

.role-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.3em 0.7em;
    border-radius: 4px;
}

.role-admin    { background: var(--tdd-accent-blue); color: var(--tdd-dark-blue); }
.role-csr      { background: var(--tdd-accent-green); color: #1a7a28; }
.role-customer { background: #F3E8FF; color: #7C3AED; }

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */
#main-content {
    margin-left: var(--sidebar-width);
}

.content-area {
    padding: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tdd-dark);
    margin-bottom: 0.25rem;
}

/* ============================================================================
   CARDS
   ============================================================================ */
.card {
    border: 1px solid var(--tdd-med-gray);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--tdd-med-gray);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.25rem;
}

.stat-card .card-body {
    padding: 1.25rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
}

.bg-primary-soft { background: var(--tdd-accent-blue); color: var(--tdd-dark-blue); }
.bg-success-soft { background: var(--tdd-accent-green); color: var(--tdd-green); }
.bg-warning-soft { background: #FEF5E4; color: var(--tdd-orange); }
.bg-info-soft    { background: #E8F4FD; color: #0284C7; }

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--tdd-dark);
    margin: 0;
}

/* ============================================================================
   BUTTONS — Override Bootstrap
   ============================================================================ */
.btn-primary {
    background: var(--tdd-primary);
    border-color: var(--tdd-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background: #4259D4;
    border-color: #4259D4;
}

.btn-success {
    background: var(--tdd-green);
    border-color: var(--tdd-green);
}

.btn-danger {
    background: var(--tdd-red);
    border-color: var(--tdd-red);
}

.btn-warning {
    background: var(--tdd-orange);
    border-color: var(--tdd-orange);
    color: #fff;
}

.btn-outline-primary {
    color: var(--tdd-primary);
    border-color: var(--tdd-primary);
}
.btn-outline-primary:hover {
    background: var(--tdd-primary);
    border-color: var(--tdd-primary);
    color: #fff;
}

/* ============================================================================
   FORMS
   ============================================================================ */
.form-control:focus, .form-select:focus {
    border-color: var(--tdd-primary);
    box-shadow: 0 0 0 0.2rem rgba(82, 106, 244, 0.2);
}

/* ============================================================================
   TABLES
   ============================================================================ */
.table thead th {
    background: var(--tdd-dark-blue);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: none;
    padding: 0.75rem;
}

.table tbody tr:nth-child(even) {
    background: var(--tdd-light-gray);
}

/* ============================================================================
   AUTH PAGES (Login, Reset, etc.)
   ============================================================================ */
.auth-body {
    background: linear-gradient(135deg, var(--tdd-dark-blue) 0%, #0a5f94 50%, var(--tdd-primary) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 1.5rem;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo img {
    height: 48px;
    margin-bottom: 0.75rem;
}

.auth-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tdd-dark-blue);
    margin: 0;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: #999;
    margin: 0.25rem 0 0;
}

.auth-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--tdd-dark);
    margin-bottom: 1.25rem;
}

.auth-link {
    color: var(--tdd-primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
}

.auth-footer p {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    margin: 0;
}

.auth-footer a {
    color: rgba(255,255,255,0.8);
}

/* ============================================================================
   CUSTOMER TABS
   ============================================================================ */
.customer-tabs {
    border-bottom: 2px solid var(--tdd-med-gray);
    margin-bottom: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.customer-tabs .nav-link {
    color: #666;
    font-weight: 500;
    font-size: 0.85rem;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.6rem 1rem;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.customer-tabs .nav-link:hover {
    color: var(--tdd-primary);
    border-bottom-color: rgba(82, 106, 244, 0.3);
    background: none;
}

.customer-tabs .nav-link.active {
    color: var(--tdd-primary);
    border-bottom-color: var(--tdd-primary);
    background: none;
    font-weight: 600;
}

.customer-tabs .nav-link i {
    margin-right: 0.25rem;
}

.tab-content-area {
    padding-top: 1.25rem;
}

/* ============================================================================
   ALERTS
   ============================================================================ */
.alert {
    font-size: 0.9rem;
    border-radius: 8px;
}

/* ============================================================================
   RESPONSIVE — Mobile sidebar
   ============================================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    #main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: block !important;
    }
}

@media (min-width: 992px) {
    .sidebar-toggle {
        display: none !important;
    }
}
