/**
 * NAB Tech CRM - Main Stylesheet
 * Modern design with dark mode support
 * Includes Bengali (Bangla) font support
 */

/* ========== CSS Variables ========== */
:root {
    /* Colors - Light Mode */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary: #6366f1;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;

    /* Backgrounds */
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f9fafb;

    /* Text */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* Borders */
    --border-color: #e5e7eb;
    --border-radius: 0.75rem;
    --border-radius-lg: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition: all 0.2s ease;
}

/* Dark Mode Variables */
.dark {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-card: #1f2937;
    --bg-input: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #374151;
}

/* ========== Base Styles ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ========== Typography ========== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

/* ========== Layout ========== */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Status Cards */
.stat-card {
    padding: 1.25rem;
    border-radius: var(--border-radius);
    color: white;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.stat-card.blue {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.stat-card.green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-card.red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.stat-card.purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.stat-card.teal {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
}

.stat-card.yellow {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.stat-card .stat-sub {
    font-size: 0.75rem;
    opacity: 0.75;
    margin-top: 0.5rem;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

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

/* ========== Form Elements ========== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-icon .form-input {
    padding-left: 2.75rem;
}

/* ========== Tables ========== */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table tbody tr:hover {
    background: var(--bg-input);
}

/* ========== Badges ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

.dark .badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.dark .badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.dark .badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.dark .badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* ========== Modal ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
}

/* ========== Tabs ========== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 0;
    padding-bottom: 1px;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    scroll-snap-align: start;
    flex-shrink: 0;
}

.tab:hover {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

/* Profile Header with Avatar */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--border-radius-lg);
    margin-bottom: 1rem;
    color: white;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    background: white;
    flex-shrink: 0;
}

.profile-info h2 {
    color: white;
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.profile-info p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
}

/* ========== Sidebar Layout ========== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar.hidden {
    transform: translateX(-100%);
}

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

.sidebar-logo {
    height: 60px;
    margin-bottom: 0.5rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(59, 130, 246, 0.05);
    color: var(--primary);
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.nav-section {
    padding: 0.5rem 1.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 1rem;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

.top-bar {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
}

.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-title {
    font-weight: 600;
    font-size: 1.1rem;
    flex: 1;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-user-info {
    text-align: right;
}

.header-user-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.header-user-id {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    background: var(--bg-secondary);
}

.header-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.page-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Mobile Sidebar */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    /* Note: header-menu-btn visibility is controlled in Mobile App-Like Experience section */

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
        display: none;
    }

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

/* ========== Login Page ========== */
.login-page {
    display: flex;
    min-height: 100vh;
}

.login-sidebar {
    display: none;
    width: 45%;
    background: linear-gradient(135deg, #1e3a8a, #1e293b);
    color: white;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.login-sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></svg>') repeat;
    opacity: 0.5;
}

@media (min-width: 1024px) {
    .login-sidebar {
        display: flex;
        flex-direction: column;
    }
}

.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Mobile login page adjustments for PWA banner */
@media (max-width: 768px) {
    .login-main {
        padding: 1.5rem 1rem;
        padding-bottom: 120px;
        /* Space for PWA install banner */
        align-items: flex-start;
        padding-top: 80px;
        /* Space for mobile logo */
    }

    .login-card {
        width: 100%;
        max-width: 100%;
    }

    .login-body {
        padding: 1.5rem;
    }

    .login-title {
        font-size: 1.25rem;
    }
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.login-tab {
    flex: 1;
    padding: 1rem;
    text-align: center;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.login-tab:hover,
.login-tab.active {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.login-tab.active {
    border-bottom-color: var(--primary);
}

.login-body {
    padding: 2rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* ========== Utilities ========== */
.hidden {
    display: none !important;
}

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.font-bold {
    font-weight: 700;
}

.font-medium {
    font-weight: 500;
}

.rounded {
    border-radius: var(--border-radius);
}

.rounded-full {
    border-radius: 9999px;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-input);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========== WhatsApp Float ========== */
.whatsapp-float {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #25d366;
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
    z-index: 99;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    color: white;
}

/* ========== Job Cards ========== */
.job-card {
    background: rgba(30, 58, 138, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--border-radius);
    padding: 1rem;
    transition: var(--transition);
}

.job-card:hover {
    background: rgba(30, 58, 138, 0.7);
}

.job-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.job-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    opacity: 0.8;
}

/* ========== Dark Mode Input Fix for Nested Containers ========== */
/* Fix for inputs inside containers with --bg-input background (Education, Training, Experience sections) */
.dark [style*="background: var(--bg-input)"] .form-input,
.dark [style*="background: var(--bg-input)"] .form-select,
.dark [style*="background: var(--bg-input)"] .form-textarea,
.dark [style*="background:var(--bg-input)"] .form-input,
.dark [style*="background:var(--bg-input)"] .form-select,
.dark [style*="background:var(--bg-input)"] .form-textarea {
    background: #1f2937;
    border-color: #4b5563;
}

.dark [style*="background: var(--bg-input)"] .form-input:focus,
.dark [style*="background: var(--bg-input)"] .form-select:focus,
.dark [style*="background: var(--bg-input)"] .form-textarea:focus,
.dark [style*="background:var(--bg-input)"] .form-input:focus,
.dark [style*="background:var(--bg-input)"] .form-select:focus,
.dark [style*="background:var(--bg-input)"] .form-textarea:focus {
    background: #111827;
    border-color: var(--primary);
}

/* ========== PWA Install Banner ========== */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: white;
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.pwa-install-banner.show {
    display: flex;
}

.pwa-install-banner .pwa-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.pwa-install-banner .pwa-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.pwa-install-banner .pwa-text h4 {
    margin: 0;
    font-size: 0.875rem;
    color: white;
}

.pwa-install-banner .pwa-text p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.9;
}

.pwa-install-banner .pwa-buttons {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.pwa-install-banner .btn-install {
    background: white;
    color: #1e3a8a;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.pwa-install-banner .btn-dismiss {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
}

/* Mobile PWA Banner - Compact layout for login page */
@media (max-width: 480px) {
    .pwa-install-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.875rem;
        padding-bottom: calc(0.875rem + env(safe-area-inset-bottom));
    }

    .pwa-install-banner .pwa-info {
        justify-content: center;
    }

    .pwa-install-banner .pwa-icon {
        width: 40px;
        height: 40px;
    }

    .pwa-install-banner .pwa-text h4 {
        font-size: 0.8rem;
    }

    .pwa-install-banner .pwa-text p {
        font-size: 0.7rem;
    }

    .pwa-install-banner .pwa-buttons {
        justify-content: center;
    }

    .pwa-install-banner .btn-install,
    .pwa-install-banner .btn-dismiss {
        flex: 1;
        text-align: center;
        padding: 0.625rem 0.75rem;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* ========== Mobile Responsive Enhancements ========== */
@media (max-width: 768px) {

    /* Mobile stat cards - horizontal scroll */
    .stat-cards-container,
    .grid.grid-cols-4,
    .grid.md\:grid-cols-4 {
        display: flex !important;
        overflow-x: auto;
        gap: 0.75rem;
        padding-bottom: 0.5rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .stat-cards-container>*,
    .grid.grid-cols-4>.stat-card,
    .grid.md\:grid-cols-4>.stat-card {
        flex: 0 0 auto;
        min-width: 140px;
        scroll-snap-align: start;
    }

    .stat-card {
        padding: 0.875rem;
    }

    .stat-card .stat-value {
        font-size: 1.25rem;
    }

    /* AUTO table to card view - applies to ALL tables on mobile */
    .table-container .table,
    .card .table {
        display: block;
    }

    .table-container .table thead,
    .card .table thead {
        display: none;
    }

    .table-container .table tbody,
    .card .table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .table-container .table tbody tr,
    .card .table tbody tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        padding: 1rem;
        box-shadow: var(--shadow-sm);
        margin-bottom: 0.5rem;
    }

    .table-container .table tbody tr:hover,
    .card .table tbody tr:hover {
        background: var(--bg-card);
        box-shadow: var(--shadow);
    }

    .table-container .table tbody td,
    .card .table tbody td {
        display: block;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-color);
        text-align: right;
    }

    .table-container .table tbody td:last-child,
    .card .table tbody td:last-child {
        border-bottom: none;
    }

    .table-container .table tbody td::before,
    .card .table tbody td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--text-secondary);
        text-transform: uppercase;
    }

    /* Grid adjustments for mobile */
    .grid {
        grid-template-columns: 1fr !important;
    }

    .grid.gap-4,
    .grid.gap-6 {
        gap: 0.75rem;
    }

    /* Mobile navigation improvements */
    .sidebar {
        width: 85%;
        max-width: 300px;
    }

    .nav-link {
        padding: 1rem 1.25rem;
        font-size: 0.9375rem;
    }

    .nav-section {
        padding: 0.75rem 1.25rem;
    }

    /* Header improvements - sticky on mobile */
    .header {
        padding: 0.75rem 1rem;
        position: sticky;
        top: 0;
        z-index: 30;
        background: var(--bg-card);
    }

    /* Note: header-menu-btn is hidden by the Mobile App-Like Experience section below */

    /* Page content padding */
    .page-content {
        padding: 1rem;
    }

    /* Cards on mobile */
    .card {
        padding: 1rem;
        border-radius: var(--border-radius);
        margin-bottom: 0.75rem;
    }

    .card-title {
        font-size: 1rem;
    }

    /* Buttons on mobile - larger touch targets */
    .btn {
        padding: 0.75rem 1rem;
        min-height: 44px;
    }

    .btn-sm {
        padding: 0.5rem 0.75rem;
        min-height: 36px;
    }

    /* Modal improvements on mobile - bottom sheet style */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal {
        border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
        max-height: 90vh;
        max-width: 100%;
        width: 100%;
    }

    .modal-header {
        position: sticky;
        top: 0;
        background: var(--bg-card);
        z-index: 10;
    }

    /* Form improvements - larger touch targets */
    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.875rem 1rem;
        font-size: 16px;
        /* Prevents zoom on iOS */
        min-height: 48px;
    }

    /* Hide scrollbars but keep scrolling */
    .stat-cards-container::-webkit-scrollbar,
    .table-container::-webkit-scrollbar {
        display: none;
    }

    .stat-cards-container,
    .table-container {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    /* Top bar adjustments */
    .top-bar {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 0.25rem;
        font-size: 0.7rem;
    }

    /* Actions column in tables - stack buttons */
    .table tbody td .btn+.btn {
        margin-top: 0.5rem;
    }

    /* Badge adjustments */
    .badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.5rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .page-content {
        padding: 0.75rem;
    }

    .card {
        padding: 0.875rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1rem;
    }

    /* WhatsApp button repositioning for bottom banner */
    .whatsapp-float {
        bottom: 80px;
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    /* Stat card mobile */
    .stat-card .stat-label {
        font-size: 0.65rem;
    }

    .stat-card .stat-value {
        font-size: 1.125rem;
    }
}

/* ========== Mobile App-Like Experience ========== */

/* Mobile Home Screen Navigation - Shows after login */
.mobile-home-nav {
    display: none;
    padding: 1rem;
    background: var(--bg-primary);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.mobile-home-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--border-radius-lg);
    color: white;
}

.mobile-home-header h2 {
    color: white;
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.mobile-home-header p {
    opacity: 0.9;
    font-size: 0.875rem;
}

.mobile-nav-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    min-width: 0;
    box-sizing: border-box;
}

.mobile-nav-btn:hover,
.mobile-nav-btn:active {
    transform: scale(0.98);
    box-shadow: var(--shadow);
    border-color: var(--primary);
    color: var(--text-primary);
}

.mobile-nav-btn.active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.mobile-nav-btn i {
    font-size: 2rem;
    color: var(--primary);
}

.mobile-nav-btn span {
    font-size: 0.875rem;
    font-weight: 600;
}

/* Swipeable Stat Cards Container */
.stat-cards-mobile {
    display: flex;
    overflow-x: auto;
    gap: 0.75rem;
    padding: 0.5rem 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.stat-cards-mobile::-webkit-scrollbar {
    display: none;
}

.stat-cards-mobile .stat-card {
    flex: 0 0 auto;
    min-width: 150px;
    max-width: 180px;
    scroll-snap-align: start;
}

/* Scroll indicator dots */
.scroll-indicator {
    display: none;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.scroll-indicator .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-color);
    transition: var(--transition);
}

.scroll-indicator .dot.active {
    background: var(--primary);
    width: 16px;
    border-radius: 3px;
}

/* Mobile Table Cards Enhancement */
.mobile-card-view {
    display: none;
}

.mobile-table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.mobile-table-card .card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.mobile-table-card .card-row:last-child {
    border-bottom: none;
}

.mobile-table-card .card-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.mobile-table-card .card-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    text-align: right;
}

/* Mobile Responsive Overrides */
@media (max-width: 768px) {

    /* Show mobile elements */
    .mobile-home-nav {
        display: block;
    }

    .scroll-indicator {
        display: flex;
    }

    /* Mobile sidebar - hidden by default, slides in when active */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        display: block !important;
    }

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

    /* Sidebar overlay - for closing sidebar on tap */
    .sidebar-overlay {
        display: block !important;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Adjust main content for no sidebar */
    .main-content {
        margin-left: 0;
        padding-bottom: 1rem;
    }

    /* Show hamburger menu button on mobile */
    .header-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: var(--border-radius);
        background: rgba(59, 130, 246, 0.1);
        color: var(--primary);
        font-size: 1.25rem;
        cursor: pointer;
        flex-shrink: 0;
    }

    .header-menu-btn:hover {
        background: rgba(59, 130, 246, 0.2);
    }

    /* Mobile header - sticky at top with profile image */
    .header.mobile-header {
        position: sticky;
        top: 0;
        z-index: 100;
        padding: 0.5rem 1rem;
        gap: 0.5rem;
        background: var(--bg-card);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .header-title {
        font-size: 0.9rem;
        flex: 1;
    }

    .header-user-name {
        font-size: 0.75rem;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-user-id {
        font-size: 0.6rem;
    }

    .header-avatar {
        width: 35px;
        height: 35px;
    }

    /* Hide old h2 header text */
    .header h2 {
        display: none;
    }

    /* Stat cards as 2x2 grid on mobile instead of horizontal scroll */
    .grid.grid-cols-1[style*="grid-template-columns: repeat(auto-fit"] {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem;
        padding: 0;
    }

    .grid.grid-cols-1[style*="grid-template-columns: repeat(auto-fit"]>.stat-card {
        min-width: 0;
        max-width: 100%;
    }

    /* Smaller stat card values on mobile */
    .stat-card {
        padding: 0.75rem;
    }

    .stat-card .stat-label {
        font-size: 0.6rem;
    }

    .stat-card .stat-value {
        font-size: 0.9rem;
    }

    .stat-card .stat-sub {
        font-size: 0.55rem;
    }

    /* Page content adjustments - strict containment */
    .main-content {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .page-content {
        padding: 0.5rem;
        padding-bottom: 1rem;
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Cards spacing */
    .card {
        margin-bottom: 1rem;
        padding: 0.75rem;
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Grid layout on mobile */
    .grid[style*="grid-template-columns: 1fr 2fr"] {
        display: block !important;
    }

    /* Profile page form fixes - force all grids to single column */
    .grid[style*="grid-template-columns: repeat(auto-fit"],
    .grid.gap-4,
    .grid.gap-6 {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .grid>* {
        margin-bottom: 0.75rem;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Form inputs full width on mobile */
    .form-input,
    .form-select,
    .form-textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        font-size: 16px !important;
    }

    .form-group {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden;
        margin-bottom: 0.75rem;
        box-sizing: border-box;
    }

    .form-label {
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    /* Form card containment */
    #profileForm,
    form.card {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        padding: 0.5rem !important;
        box-sizing: border-box;
    }

    /* Tab content containment */
    .tab-content {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box;
    }

    /* Mobile tabs - scrollable with visible hint */
    .tabs {
        background: var(--bg-secondary);
        border-radius: var(--border-radius) var(--border-radius) 0 0;
        padding: 0 0.5rem;
        margin: 0 -0.5rem;
        width: calc(100% + 1rem);
    }

    .tabs::after {
        content: '→';
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-muted);
        opacity: 0.5;
        font-size: 0.8rem;
        animation: pulse 2s infinite;
    }

    .tabs-wrapper {
        position: relative;
    }

    .tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.7rem;
    }

    /* Profile image/sign upload area */
    .grid>div[style*="display: flex"][style*="gap: 1rem"],
    div[style*="display: flex"][style*="gap: 1rem"][style*="grid-column"] {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem !important;
    }

    /* Make all inline grids stack on mobile */
    .grid.gap-4,
    .grid.gap-6 {
        display: block !important;
    }

    .grid.gap-4>*,
    .grid.gap-6>* {
        margin-bottom: 0.75rem;
    }

    /* Profile header mobile */
    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    .profile-avatar {
        width: 70px;
        height: 70px;
    }

    .profile-info h2 {
        font-size: 1.1rem;
    }

    /* Tab content overflow fix */
    .tab-content {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Card title smaller on mobile */
    .card-title {
        font-size: 1rem;
    }

    /* Ensure all text wraps */
    .form-label {
        font-size: 0.75rem;
    }

    /* WhatsApp button position */
    .whatsapp-float {
        bottom: 20px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .mobile-nav-grid {
        gap: 0.75rem;
    }

    .mobile-nav-btn {
        padding: 1.25rem 0.75rem;
    }

    .mobile-nav-btn i {
        font-size: 1.75rem;
    }

    .mobile-nav-btn span {
        font-size: 0.8rem;
    }

    .stat-cards-mobile .stat-card,
    .grid.grid-cols-1[style*="grid-template-columns: repeat(auto-fit"]>.stat-card {
        min-width: 130px;
        max-width: 160px;
    }
}

/* Dark mode adjustments for mobile nav */
.dark .mobile-nav-btn {
    background: var(--bg-card);
    border-color: var(--border-color);
}

.dark .mobile-home-header {
    background: linear-gradient(135deg, #1e3a8a, #1e293b);
}

/* ========== Modal Styles ========== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-title i {
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Button Sizes */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Responsive Modal */
@media (max-width: 640px) {
    .modal {
        margin: 1rem;
        max-height: 85vh;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }
}