/* ==========================================================================
   KRSF Field Visit & Expense Portal - Design System & Custom Styles
   Theme: Premium White & Green
   ========================================================================== */

/* Design Tokens & Variables */
:root {
    /* Color Palette */
    --color-primary: #15803d;       /* Rich Green */
    --color-primary-hover: #166534; /* Darker Green */
    --color-primary-light: #dcfce7; /* Light Green tint */
    --color-primary-glow: rgba(21, 128, 61, 0.15);
    
    --color-success: #16a34a;       /* Success Green */
    --color-success-light: #f0fdf4;
    --color-warning: #ca8a04;       /* Amber/Warning */
    --color-warning-light: #fefbeb;
    --color-danger: #dc2626;        /* Red/Alert */
    --color-danger-light: #fef2f2;
    --color-info: #0284c7;          /* Blue Info */
    --color-info-light: #f0f9ff;

    --color-bg-main: #f8fafc;       /* Slate 50 background */
    --color-bg-card: #ffffff;
    --color-bg-sidebar: #14532d;    /* Deep Forest Green */
    --color-border: #e2e8f0;        /* Slate 200 */
    --color-border-hover: #cbd5e1;

    --color-text-dark: #0f172a;     /* Slate 900 */
    --color-text-muted: #64748b;    /* Slate 500 */
    --color-text-light: #ffffff;

    /* Shadows & Border Radius */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.07);
    --shadow-premium: 0 20px 25px -5px rgba(20, 83, 45, 0.06), 0 8px 10px -6px rgba(20, 83, 45, 0.04);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition-normal: all 0.25s ease;
    
    /* Layout */
    --sidebar-width: 270px;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--color-bg-main);
    color: var(--color-text-dark);
    font-size: 0.95rem;
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font-size: inherit;
    color: inherit;
}

/* Utility Helpers */
.hidden { display: none !important; }
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.bold { font-weight: 600; }
.max-w-3xl { max-width: 48rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }
.gap-4 { gap: 1rem; }
.border-top { border-top: 1px solid var(--color-border); }
.border-bottom { border-bottom: 1px solid var(--color-border); }
.bg-warning-light { background-color: var(--color-warning-light); }
.text-warning { color: var(--color-warning); }
.bg-info-light { background-color: var(--color-info-light); }
.text-info { color: var(--color-info); }

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* TOAST NOTIFICATION SYSTEM */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--color-bg-card);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 16px 20px;
    min-width: 320px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: auto;
    transition: var(--transition-normal);
}

.toast.toast-success { border-left-color: var(--color-success); }
.toast.toast-warning { border-left-color: var(--color-warning); }
.toast.toast-danger { border-left-color: var(--color-danger); }

.toast-message {
    flex-grow: 1;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    opacity: 0.6;
}
.toast-close:hover { opacity: 1; }

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* LOGIN SCREEN STYLING */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at 10% 20%, rgba(22, 163, 74, 0.05) 0%, rgba(255, 255, 255, 0) 90%), var(--color-bg-main);
    padding: 24px;
}

.login-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    border: 1px solid var(--color-border);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    text-align: center;
    animation: cardEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    width: 90px;
    height: auto;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
}

.login-header h2 {
    color: var(--color-bg-sidebar);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.login-subtitle {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.login-header .divider {
    height: 3px;
    width: 40px;
    background-color: var(--color-primary);
    margin: 16px auto;
    border-radius: var(--radius-full);
}

.login-header h3 {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--color-text-dark);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.88rem;
    color: var(--color-text-dark);
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.currency-symbol {
    position: absolute;
    left: 16px;
    font-weight: 600;
    color: var(--color-primary);
}

.input-icon-wrapper input,
.input-icon-wrapper select,
.form-group textarea,
.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    outline: none;
    transition: var(--transition-fast);
    background-color: var(--color-bg-card);
}

.input-icon-wrapper input[type="text"],
.input-icon-wrapper input[type="email"],
.input-icon-wrapper input[type="password"] {
    padding-left: 44px;
}

.input-icon-wrapper input[type="number"] {
    padding-left: 32px;
}

.input-icon-wrapper input:focus,
.input-icon-wrapper select:focus,
.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-glow);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    outline: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--color-primary-hover);
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.2);
}

.btn-secondary {
    background-color: white;
    border: 1px solid var(--color-border);
    color: var(--color-text-dark);
}
.btn-secondary:hover {
    background-color: var(--color-bg-main);
    border-color: var(--color-border-hover);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-white {
    background-color: white;
    color: var(--color-primary);
    box-shadow: var(--shadow-md);
}
.btn-white:hover {
    background-color: #f8fafc;
    transform: translateY(-1px);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-text {
    background: none;
    border: none;
    color: var(--color-primary);
    font-weight: 600;
    cursor: pointer;
}
.btn-text:hover {
    text-decoration: underline;
}

.login-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px dashed var(--color-border);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.login-footer p {
    margin-bottom: 4px;
}

/* PORTAL LAYOUT STYLING */
.portal-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Overlay Backdrop (Mobile & Tablet) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 95;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--color-bg-sidebar);
    color: var(--color-text-light);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition-normal);
}

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

.brand-logo {
    width: 42px;
    height: auto;
    border-radius: var(--radius-sm);
    background: white;
    padding: 2px;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info {
    overflow: hidden;
}

.user-info h4 {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-badge {
    display: inline-block;
    font-size: 0.7rem;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-top: 2px;
}

.sidebar-nav {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-link.active {
    background-color: white;
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.badge {
    position: absolute;
    right: 16px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: var(--radius-full);
}

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

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}
.btn-logout:hover {
    background-color: rgba(220, 38, 38, 0.1);
    color: #fecaca;
}

/* Main Panel Styling */
.main-panel {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    height: 70px;
    background-color: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.view-title {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--color-text-dark);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-dark);
}

.header-datetime {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.main-content {
    flex-grow: 1;
    padding: 32px;
}

/* VIEW CARDS */
.card {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text-dark);
}

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

.card-header-bordered h3 {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-text-dark);
    margin-bottom: 4px;
}

.card-body {
    padding: 24px;
}

/* ANIMATIONS */
.view-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* WELCOME BANNER */
.welcome-banner {
    background: linear-gradient(135deg, var(--color-bg-sidebar) 0%, var(--color-primary) 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    box-shadow: var(--shadow-premium);
}

.welcome-text h1 {
    font-weight: 700;
    font-size: 1.75rem;
    margin-bottom: 6px;
}

.welcome-text p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    max-width: 600px;
}

/* STATS CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-normal);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary-light);
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon-wrapper i {
    width: 24px;
    height: 24px;
}

.stat-primary { background-color: var(--color-primary-light); color: var(--color-primary); }
.stat-warning { background-color: var(--color-warning-light); color: var(--color-warning); }
.stat-success { background-color: var(--color-success-light); color: var(--color-success); }
.stat-danger { background-color: var(--color-danger-light); color: var(--color-danger); }
.stat-info { background-color: var(--color-info-light); color: var(--color-info); }

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.stat-value {
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--color-text-dark);
}

.stat-sub {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* LAYOUT FOR DASHBOARDS */
.dashboard-content-layout {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

/* TABLES styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th, .table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.table th {
    background-color: var(--color-bg-main);
    font-weight: 600;
    color: var(--color-text-dark);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap !important;
}

.table td.wrap-cell {
    white-space: normal !important;
    word-break: break-word;
    min-width: 180px;
    max-width: 320px;
}

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

.table th.sortable-th {
    cursor: pointer;
    user-select: none;
}

.table th.sortable-th:hover {
    color: var(--color-primary);
}

.table th .sort-indicator {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.75em;
    opacity: 0.35;
}

.table th.sortable-th.sort-active .sort-indicator {
    opacity: 1;
    color: var(--color-primary);
}

.table tr:hover td {
    background-color: rgba(21, 128, 61, 0.01);
}

/* Claim Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.status-pending { background-color: var(--color-warning-light); color: var(--color-warning); }
.status-approved { background-color: var(--color-success-light); color: var(--color-success); }
.status-rejected { background-color: var(--color-danger-light); color: var(--color-danger); }

/* Expense Category Icon Badge */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.category-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.category-icon i {
    width: 14px;
    height: 14px;
}

.cat-travel { background-color: #e0f2fe; color: #0369a1; }
.cat-stay { background-color: #faf5ff; color: #7e22ce; }
.cat-food { background-color: #ffedd5; color: #c2410c; }
.cat-other { background-color: #f1f5f9; color: #475569; }

/* Guidelines Card List */
.guidelines-list {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guideline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.guideline-num {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.guideline-item p {
    font-size: 0.88rem;
    color: var(--color-text-muted);
}

/* SUBMISSION FORM */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 24px;
    margin-top: 24px;
}

/* Upload receipt zone */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    background-color: var(--color-bg-main);
    position: relative;
}

.upload-zone:hover {
    border-color: var(--color-primary);
    background-color: rgba(21, 128, 61, 0.02);
}

.upload-icon {
    width: 40px;
    height: 40px;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}

.upload-text {
    font-weight: 500;
    margin-bottom: 4px;
}
.upload-text span {
    color: var(--color-primary);
    text-decoration: underline;
}

.upload-subtext {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.receipt-preview-container {
    position: relative;
    max-width: 100%;
    max-height: 240px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: inline-block;
}

.receipt-preview-container img {
    max-height: 240px;
    width: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.btn-remove-file {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(15, 23, 42, 0.8);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.btn-remove-file:hover {
    background-color: var(--color-danger);
}

/* HISTORY FILTER BAR */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-export-group {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.filter-group select,
.filter-group input[type="date"] {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    outline: none;
    background-color: white;
    font-size: 0.88rem;
    font-family: inherit;
}

/* QUICK ACTIONS IN ADMIN */
.quick-admin-actions {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quick-action-btn {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: var(--transition-normal);
}
.quick-action-btn:hover {
    border-color: var(--color-primary-light);
    background-color: rgba(21, 128, 61, 0.02);
    transform: translateX(4px);
}

.action-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.action-icon i {
    width: 20px;
    height: 20px;
}

.action-text h4 {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text-dark);
}

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

/* ANALYTICS CHART CONTAINER */
.chart-container-wrapper {
    position: relative;
    height: 280px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* MODAL OVERLAY STYLING */
.modal-overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

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

.modal-header h3 {
    font-weight: 700;
    font-size: 1.15rem;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
}
.modal-close:hover {
    color: var(--color-text-dark);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

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

/* Detail modal elements */
.modal-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.modal-detail-item {
    display: flex;
    flex-direction: column;
}

.modal-detail-item label {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.modal-detail-item span {
    font-size: 0.95rem;
    font-weight: 500;
}

.modal-detail-item-full {
    grid-column: span 2;
}

.modal-receipt-preview {
    margin-top: 16px;
    text-align: center;
}

.modal-receipt-preview label {
    display: block;
    text-align: left;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.modal-receipt-preview img {
    max-height: 320px;
    max-width: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 4px;
}

.modal-comment-section {
    grid-column: span 2;
    margin-top: 8px;
    padding: 12px;
    background-color: var(--color-bg-main);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--color-primary);
}
.modal-comment-section.rejected {
    border-left-color: var(--color-danger);
}
.modal-comment-section label {
    display: block;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}
.modal-comment-section p {
    font-style: italic;
    font-size: 0.9rem;
}

.admin-comment-textarea {
    width: 100%;
    margin-top: 16px;
}

/* RESPONSIVE MEDIA QUERIES */

/* Tablets and Mobile Drawer (< 1024px) */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 270px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-premium);
        z-index: 100;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-panel {
        margin-left: 0;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        border-radius: var(--radius-sm);
        transition: var(--transition-fast);
    }

    .mobile-toggle:hover {
        background-color: var(--color-bg-main);
    }

    .dashboard-content-layout {
        grid-template-columns: 1fr;
    }
    
    .col-span-2,
    .col-span-3 {
        grid-column: span 1 / span 1;
    }
}

/* Tablets & Mobile Phones (< 768px) */
@media (max-width: 768px) {
    html, body {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .main-header {
        padding: 10px 12px;
        height: auto;
        min-height: 56px;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: space-between;
        max-width: 100vw;
        overflow: hidden;
    }

    .view-title {
        font-size: 1.1rem;
        word-break: break-word;
        line-height: 1.2;
    }

    .header-actions {
        margin-left: auto;
        max-width: 100%;
    }

    .header-datetime {
        font-size: 0.78rem !important;
        padding: 4px 8px !important;
        gap: 4px !important;
        max-width: 100%;
        overflow: hidden;
    }

    .main-content {
        padding: 12px;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        gap: 14px;
        border-radius: var(--radius-md);
    }

    .welcome-text h1 {
        font-size: 1.3rem;
    }

    .welcome-text p {
        font-size: 0.85rem;
    }

    #welcome-submit-btn {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 14px;
        gap: 10px;
        border-radius: var(--radius-md);
    }

    .stat-icon-wrapper {
        width: 38px;
        height: 38px;
        flex-shrink: 0;
    }

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

    .card {
        border-radius: var(--radius-md);
        margin-bottom: 16px;
        max-width: 100%;
        overflow: hidden;
    }

    .card-header,
    .card-header-bordered,
    .card-body {
        padding: 14px;
    }

    .grid-cols-4,
    .grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .col-span-mobile {
        grid-column: span 2 / span 2;
    }

    /* Filter Bar & Export Buttons Responsive */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    .filter-group {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .filter-group label {
        font-size: 0.76rem;
        margin-bottom: 2px;
    }

    .filter-group select,
    .filter-group input[type="date"] {
        width: 100% !important;
        height: 40px;
        font-size: 0.85rem;
    }

    .filter-export-group {
        margin-left: 0 !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
        margin-top: 4px !important;
    }

    .filter-export-group .btn {
        flex: 1 1 50% !important;
        width: 50% !important;
        justify-content: center !important;
        height: 40px !important;
        font-size: 0.85rem !important;
        min-width: 0 !important;
    }

    /* Mobile Stacked Table Cards Layout */
    .table-responsive {
        width: 100%;
        max-width: 100%;
        overflow: visible !important;
        background: transparent;
    }

    .table {
        min-width: 100% !important;
        width: 100% !important;
        border-collapse: separate;
        border-spacing: 0;
    }

    .table thead {
        display: none !important;
    }

    .table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .table tbody tr {
        display: flex;
        flex-direction: column;
        background-color: var(--color-bg-card);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        padding: 14px 16px;
        box-shadow: var(--shadow-sm);
        gap: 8px;
        position: relative;
        width: 100%;
    }

    .table tbody tr:hover td {
        background-color: transparent;
    }

    .table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 6px 0 !important;
        border-bottom: 1px dashed var(--color-border) !important;
        font-size: 0.86rem;
        white-space: normal !important;
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        text-align: right;
    }

    .table td:last-child {
        border-bottom: none !important;
        padding-top: 10px !important;
        padding-bottom: 0 !important;
        justify-content: stretch;
    }

    .table td:last-child .btn,
    .table td .btn-sm {
        width: 100%;
        height: 40px;
        justify-content: center;
        font-size: 0.85rem;
    }

    .table td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.76rem;
        color: var(--color-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        text-align: left;
        padding-right: 12px;
        flex-shrink: 0;
    }

    .table td.wrap-cell {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: 4px;
    }

    .table td.wrap-cell[data-label]::before {
        margin-bottom: 2px;
    }

    .table td[data-label="Select"],
    .table td:first-child:has(input[type="checkbox"]) {
        position: absolute;
        top: 12px;
        right: 12px;
        width: auto !important;
        border-bottom: none !important;
        padding: 0 !important;
        justify-content: flex-end;
    }

    .table td[data-label="Select"]::before {
        display: none;
    }

    .table td[colspan] {
        justify-content: center;
        text-align: center;
        border-bottom: none !important;
        padding: 24px 12px !important;
    }

    .table td[colspan]::before {
        display: none;
    }

    /* Modals Responsive */
    .modal-overlay {
        padding: 10px;
    }

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

    .modal-header {
        padding: 12px 14px;
    }

    .modal-body {
        padding: 14px;
    }

    .modal-footer {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 100px;
        justify-content: center;
        height: 40px;
    }

    .chart-container-wrapper {
        height: 200px;
    }
}

/* Small Phones (< 576px) */
@media (max-width: 576px) {
    .main-header {
        padding: 8px 10px;
    }

    /* Compact Top Header Date Display on Small Screens */
    #current-time-display,
    .clock-icon,
    .datetime-separator {
        display: none !important;
    }

    .login-container {
        padding: 14px 10px;
    }

    .login-card {
        padding: 20px 14px;
        border-radius: var(--radius-md);
    }

    .login-header h2 {
        font-size: 1.2rem;
    }

    .login-header h3 {
        font-size: 0.9rem;
        margin-bottom: 16px;
    }

    .login-logo {
        width: 65px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }

    .col-span-mobile,
    .col-span-2,
    .col-span-3 {
        grid-column: span 1 / span 1;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
        height: 42px;
    }

    .modal-detail-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .modal-detail-item-full {
        grid-column: span 1;
    }

    .toast-container {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .toast {
        min-width: 0;
        width: 100%;
        padding: 12px 14px;
    }
}

/* Extra Small Phones (< 400px) */
@media (max-width: 400px) {
    .main-header {
        padding: 6px 8px;
    }

    .view-title {
        font-size: 1.05rem;
    }

    .upload-zone {
        padding: 16px 10px;
    }

    .filter-export-group {
        flex-direction: column !important;
    }

    .filter-export-group .btn {
        width: 100% !important;
        flex: 1 1 100% !important;
    }
}
