/* ============================================
   MOBILE-FIRST RESPONSIVE DASHBOARD
   ============================================ */

/* Dashboard Layout - Mobile First */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ============================================
   HAMBURGER MENU BUTTON (Mobile Only)
   ============================================ */
.hamburger-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.hamburger-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.hamburger-btn i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* ============================================
   SIDEBAR - Mobile First (Hidden by default)
   ============================================ */
.sidebar {
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100005;
    left: -280px;
    top: 0;
    transition: left 0.3s ease;
}

.sidebar.active {
    left: 0;
}

/* Sidebar Overlay (Mobile Only) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100004;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Sidebar Header */
.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.sidebar-logo {
    max-width: 85%;
    height: auto;
    max-height: 24vh;
    object-fit: contain;
    margin-bottom: 0.75rem;
    border-radius: 6px;
    padding: 6px;
    display: inline-block;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary) !important;
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

/* Ensure consistent color for all link states */
.nav-item:link,
.nav-item:visited {
    color: var(--text-secondary) !important;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary) !important;
}

.nav-item.active {
    background: rgba(255, 152, 0, 0.1);
    color: var(--primary-color) !important;
    border-left-color: var(--primary-color);
}

.nav-item.active:link,
.nav-item.active:visited {
    color: var(--primary-color) !important;
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    color: inherit !important;
}

.nav-item span {
    color: inherit !important;
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 1.5rem;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 1.25rem;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   MAIN CONTENT - Mobile First
   ============================================ */
.main-content {
    flex: 1;
    width: 100%;
    padding: 1rem;
    background: var(--bg-dark);
    color: var(--text-primary);
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

.content-header {
    margin-bottom: 1.5rem;
    justify-content: center;
    text-align: center;
}

.content-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-heading);
}

.content-header h1 i {
    font-size: 1.25rem;
    margin-right: 0.5rem;
}

.content-header p,
.content-header .text-secondary {
    color: var(--text-secondary);
}

/* ============================================
   STATS GRID - Mobile First
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.stat-details {
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

/* Override for colored cards with explicit text-white class */
.stat-card .text-white,
.stat-value.text-white {
    color: #ffffff !important;
}

/* Stat label uses secondary text — readable in both themes */
.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Override for colored gradient cards */
.stat-card .text-white-50,
.stat-label.text-white-50 {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* ============================================
   CARD HEADER
   ============================================ */
.card-header {
    display: flex;
    justify-content: start;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 4%;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-heading);
}

/* ============================================
   TABLE RESPONSIVE
   ============================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-darker);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ============================================
   TABLET BREAKPOINT (768px and up)
   ============================================ */
@media (min-width: 768px) {
    .main-content {
        padding: 1.5rem;
    }

    .content-header h1 {
        font-size: 1.75rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-icon {
        width: 56px;
        height: 56px;
        font-size: 1.625rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }
}

/* ============================================
   DESKTOP BREAKPOINT (1024px and up)
   ============================================ */
@media (min-width: 1024px) {

    /* Hide hamburger button on desktop */
    .hamburger-btn {
        display: none;
    }

    /* Sidebar always visible on desktop */
    .sidebar {
        left: 0;
    }

    /* Overlay never shown on desktop */
    .sidebar-overlay {
        display: none !important;
    }

    /* Main content with sidebar margin */
    .main-content {
        margin-left: 300px;
        padding: 2rem;
        width: calc(100% - 300px);
        transition: margin-left 0.3s ease;
    }

    .content-header {
        margin-top: 0;
    }

    .content-header h1 {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .stat-card {
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .stat-icon {
        width: 64px;
        height: 64px;
        font-size: 1.75rem;
    }

    .stat-value {
        font-size: 2rem;
    }
}

/* ============================================
   LARGE DESKTOP (1440px and up)
   ============================================ */
@media (min-width: 1440px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Planos Overlay Button */
.planos-overlay-icon {
    z-index: 10;
    position: absolute;
    top: 10px;
    right: 10px;
    background: #79b100;
    color: #fff;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.planos-overlay-icon:hover {
    transform: scale(1.1);
    background: #8fc91a;
}

/* Planos Modal Animation */
#dashboardPlanosModal {
    transition: opacity 0.3s ease;
}

#dashboardPlanosModal button {
    transition: color 0.2s ease, transform 0.2s ease;
}

#dashboardPlanosModal button:hover {
    color: #ffc107 !important;
    transform: scale(1.1);
}

/* Highlighted buttons in planos modal */
#downloadPlanosModal {
    background-color: #79b100 !important;
    color: white !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 15px rgba(121, 177, 0, 0.5) !important;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
}
#downloadPlanosModal:hover {
    background-color: #8fc91a !important;
    color: white !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(143, 201, 26, 0.6) !important;
}

#sharePlanosModal {
    background-color: #0ea5e9 !important;
    color: white !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.5) !important;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
}
#sharePlanosModal:hover {
    background-color: #38bdf8 !important;
    color: white !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.6) !important;
}

#printPlanosModal {
    background-color: #f59e0b !important;
    color: white !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.5) !important;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
}
#printPlanosModal:hover {
    background-color: #fbbf24 !important;
    color: white !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.6) !important;
}

/* Key Word Highlighting in Description */
.description-section p strong,
.highlight-keyword,
.highlight-price,
.highlight-area {
    color: var(--primary-color) !important;
    font-weight: 700 !important;
    background: none !important;
    padding: 0 !important;
    border: none !important;
    display: inline !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

/* ============================================================
   USER PROFILE & EDIT STYLING (MODERN LUXURY UI)
   ============================================================ */
.user-edit-container {
    max-width: 880px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 50px;
}

/* Header */
.user-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 8px;
}

.user-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-header-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(37, 99, 235, 0.05) 100%);
    border: 1.5px solid var(--primary-color, #2563eb);
    color: var(--primary-color, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.user-header-left h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-heading, #0f172a);
    margin: 0;
    letter-spacing: -0.5px;
}

.user-header-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary, #64748b);
    margin: 3px 0 0;
}

.btn-back-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    background: var(--bg-card, #ffffff);
    border: 1.5px solid var(--border-color, #e2e8f0);
    color: var(--text-secondary, #64748b);
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm, 0 2px 6px rgba(0,0,0,0.03));
}

.btn-back-pill:hover {
    background: var(--bg-hover, #f1f5f9);
    color: var(--text-heading, #0f172a);
    border-color: var(--primary-color, #2563eb);
    transform: translateX(-2px);
}

/* User Profile Banner & Avatar */
.user-profile-hero {
    background: var(--bg-card, #ffffff);
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .user-profile-hero {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.08);
}

.user-profile-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color, #2563eb), #8b5cf6, #ec4899);
}

.user-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.user-avatar-img {
    width: 105px;
    height: 105px;
    border-radius: 50%;
    object-fit: cover;
    border: 3.5px solid var(--primary-color, #2563eb);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    display: block;
    background: var(--bg-surface, #f8fafc);
}

.user-avatar-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #10b981;
    border: 3px solid var(--bg-card, #ffffff);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.user-avatar-badge.inactive {
    background: #ef4444;
}

.user-hero-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-hero-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.user-hero-name {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-heading, #0f172a);
    margin: 0;
}

.user-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color, #2563eb);
    border: 1px solid rgba(37, 99, 235, 0.25);
}

.user-hero-upload-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.btn-file-custom {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 10px;
    background: var(--primary-color, #2563eb);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.25);
    transition: all 0.2s ease;
}

.btn-file-custom:hover {
    background: var(--primary-hover, #1d4ed8);
    transform: translateY(-1px);
}

.avatar-input-hidden {
    display: none;
}

.avatar-format-hint {
    font-size: 0.78rem;
    color: var(--text-secondary, #64748b);
}

/* Form Sections */
.user-form-card {
    background: var(--bg-card, #ffffff);
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .user-form-card {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.08);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

[data-theme="dark"] .user-card-header {
    border-color: rgba(255, 255, 255, 0.08);
}

.user-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.user-card-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-heading, #0f172a);
}

.user-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.user-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.user-field-group label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-heading, #1e293b);
}

[data-theme="dark"] .user-field-group label {
    color: #e2e8f0;
}

.user-field-group label .req {
    color: #ef4444;
}

.user-input-box {
    position: relative;
    display: flex;
    align-items: center;
}

.user-input-box i.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.95rem;
    pointer-events: none;
}

.user-input-box input,
.user-input-box select {
    width: 100%;
    padding: 11px 14px 11px 40px;
    font-size: 0.9rem;
    border-radius: 12px;
    border: 1.5px solid var(--border-color, #cbd5e1);
    background: var(--bg-surface, #f8fafc);
    color: var(--text-heading, #0f172a);
    box-sizing: border-box;
    transition: all 0.2s ease;
    font-family: inherit;
}

[data-theme="dark"] .user-input-box input,
[data-theme="dark"] .user-input-box select {
    background: #0b0f19;
    border-color: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.user-input-box input:focus,
.user-input-box select:focus {
    outline: none;
    border-color: var(--primary-color, #2563eb);
    background: var(--bg-card, #ffffff);
    box-shadow: 0 0 0 3.5px var(--primary-muted, rgba(37, 99, 235, 0.15));
}

[data-theme="dark"] .user-input-box input:focus,
[data-theme="dark"] .user-input-box select:focus {
    background: #0f172a;
}

.btn-toggle-eye {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary, #94a3b8);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s ease;
}

.btn-toggle-eye:hover {
    color: var(--text-heading, #0f172a);
}

.field-hint {
    font-size: 0.76rem;
    color: var(--text-secondary, #64748b);
    margin-top: 2px;
}

/* Switch de Estado */
.user-switch-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    padding: 12px 16px;
    background: var(--bg-surface, #f8fafc);
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    transition: all 0.2s ease;
}

[data-theme="dark"] .user-switch-label {
    background: #0b0f19;
    border-color: rgba(255, 255, 255, 0.08);
}

.user-switch-label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-slider {
    width: 44px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 20px;
    position: relative;
    transition: background 0.25s ease;
    flex-shrink: 0;
}

.switch-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.user-switch-label input:checked + .switch-slider {
    background: #10b981;
}

.user-switch-label input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.switch-text-group {
    display: flex;
    flex-direction: column;
}

.switch-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-heading, #0f172a);
}

.switch-desc {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
}

/* Actions Footer */
.user-edit-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    padding-top: 10px;
}

.btn-save-profile {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 12px;
    background: var(--primary-color, #2563eb);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 800;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--primary-muted, rgba(37, 99, 235, 0.35));
    transition: all 0.25s ease;
}

.btn-save-profile:hover {
    background: var(--primary-hover, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 6px 22px var(--primary-muted, rgba(37, 99, 235, 0.45));
}

.btn-cancel-profile {
    display: inline-flex;
    align-items: center;
    padding: 12px 20px;
    border-radius: 12px;
    background: none;
    border: 1.5px solid var(--border-color, #cbd5e1);
    color: var(--text-secondary, #64748b);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-cancel-profile:hover {
    background: var(--bg-surface, #f8fafc);
    color: var(--text-heading, #0f172a);
}

@media (max-width: 768px) {
    .user-profile-hero {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    .user-hero-title-row {
        justify-content: center;
    }
    .user-hero-upload-row {
        justify-content: center;
    }
    .user-grid-2 {
        grid-template-columns: 1fr;
    }
    .user-edit-footer {
        flex-direction: column-reverse;
    }
    .btn-save-profile, .btn-cancel-profile {
        width: 100%;
        justify-content: center;
    }
}