/* assets/css/style.css */
:root {
    --primary-color: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    /* Indigo 700 */
    --primary-light: #eef2ff;
    --secondary-color: #64748b;
    /* Slate 500 */
    --background-color: #f8fafc;
    /* Slate 50 */
    --surface-color: #ffffff;
    --text-primary: #0f172a;
    /* Slate 900 */
    --text-secondary: #475569;
    /* Slate 600 */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --border-color: #e2e8f0;
    --border-radius: 0.75rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Utilities */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.flex-col {
    flex-direction: column;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.w-full {
    width: 100%;
}

.h-screen {
    height: 100vh;
}

.hidden {
    display: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-block {
    width: 100%;
    min-height: 44px;
    /* Mobile touch friendly */
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--surface-color);
    transition: all 0.2s;
    font-size: 0.9375rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

input[type="password"] {
    letter-spacing: 0.15em;
    /* Spaced out dots for better readability */
}

.password-toggle-group {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle-group .form-control {
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0;
    font-size: 1rem;
}

.toggle-password:hover {
    color: var(--primary-color);
}

input[type="password"]::placeholder {
    letter-spacing: normal;
    /* Keep placeholder text readable */
}

/* Chrome, Safari, Edge, Opera autofill color fix */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

.input-icon-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-group i {
    position: absolute;
    left: 0.875rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    pointer-events: none;
}

.input-icon-group .form-control {
    padding-left: 2.5rem;
}

/* Dashboard Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--surface-color);
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    z-index: 50;
    transition: transform 0.3s ease-in-out;
}

.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 0.25rem;
}

.nav-link:hover,
.nav-link.active {
    background-color: #e0e7ff;
    color: var(--primary-color);
}

.nav-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-wrapper {
    flex: 1;
    padding: 1.5rem;
}

.app-footer {
    width: 100% !important;
    text-align: center !important;
    padding: 1.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.825rem;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
    background-color: var(--background-color);
    display: block !important;
}

/* Topbar Mobile */
.mobile-header {
    display: none;
    height: 64px;
    background: var(--surface-color);
    border-bottom: 1px solid #e2e8f0;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

/* Cards */
.card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    display: flex;
    flex-direction: column;
}

.summary-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-color);
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active {
    background-color: #dcfce7;
    color: #166534;
}

.status-left {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ============================================
   TABLET (≤ 1024px) — Sidebar collapses
   ============================================ */
@media (max-width: 1024px) {

    html,
    body {
        overflow-x: hidden;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-header {
        display: flex;
    }

    .content-wrapper {
        padding: 1rem;
    }

    /* Mobile menu toggle button sizing */
    .mobile-menu-btn {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f1f5f9;
        border: none;
        cursor: pointer;
        font-size: 1.1rem;
        color: var(--primary-color);
        border-radius: 10px;
        transition: all 0.2s;
    }

    .mobile-menu-btn:active {
        transform: scale(0.9);
        background: #e2e8f0;
    }

    .mobile-header {
        backdrop-filter: blur(8px);
        background: rgba(255, 255, 255, 0.95);
        padding: 0.6rem 1rem;
        height: 60px;
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        position: sticky;
        top: 0;
        z-index: 900;
        border-bottom: 1px solid #f1f5f9;
    }
}



/* ============================================
   MOBILE (≤ 768px) — Full mobile optimisation
   ============================================ */
@media (max-width: 768px) {

    /* --- Prevent horizontal scroll --- */
    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative;
    }

    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .content-wrapper {
        padding: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .container {
        width: 100% !important;
        padding: 0 !important;
        max-width: 100% !important;
    }

    /* --- Headers & Titles --- */
    div[style*="display: flex"][style*="justify-content: space-between"],
    div[style*="display:flex"][style*="justify-content:space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    div[style*="display: flex"][style*="justify-content: space-between"]>button,
    div[style*="display:flex"][style*="justify-content:space-between"]>button,
    div[style*="display: flex"][style*="justify-content: space-between"]>.btn,
    div[style*="display:flex"][style*="justify-content:space-between"]>.btn {
        width: 100% !important;
    }

    h2 {
        font-size: 1.25rem !important;
        margin-bottom: 0.25rem !important;
    }

    p {
        font-size: 0.85rem !important;
    }

    /* --- Cards --- */
    .card {
        padding: 0.85rem !important;
        margin-bottom: 0.75rem !important;
        border-radius: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .card[style*="padding:0"],
    .card[style*="padding: 0"] {
        padding: 0 !important;
    }

    /* --- Summary Grids --- */
    .summary-grid,
    .grid[style*="grid-template-columns: repeat"],
    .grid[style*="grid-template-columns:repeat"] {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    @media (min-width: 480px) {
        .summary-grid {
            grid-template-columns: 1fr 1fr !important;
        }
    }

    /* --- Tables (Desktop Only Hide) --- */
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    /* --- Mobile Card Styles --- */
    .mobile-table-card {
        border: 1px solid #f1f5f9;
        border-radius: 10px;
        padding: 1rem;
        margin-bottom: 1rem;
        background: #fff;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    }

    .mobile-table-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f8fafc;
        gap: 0.5rem;
    }

    .mobile-label {
        font-weight: 700;
        font-size: 0.7rem;
        color: #94a3b8;
        text-transform: uppercase;
    }

    /* --- Form Control --- */
    .form-control,
    input,
    select,
    textarea {
        font-size: 16px !important;
        height: 44px !important;
    }
}

/* ============================================
   VERY SMALL (≤ 400px)
   ============================================ */
@media (max-width: 400px) {
    .summary-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }

    .summary-value {
        font-size: 1.2rem !important;
    }

    .content-wrapper {
        padding: 0.5rem !important;
    }

    .card {
        padding: 0.75rem !important;
    }

    .table {
        font-size: 0.72rem !important;
    }

    .table th,
    .table td {
        padding: 0.4rem 0.5rem !important;
    }
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
    display: none;
}

.overlay.active {
    display: block;
}

/* Login Page Specific */
.login-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: radial-gradient(circle at top right, #eef2ff 0%, #f8fafc 50%, #f1f5f9 100%);
}

.login-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    border: none;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #818cf8);
}

.login-logo {
    height: 54px;
    width: auto;
    margin-bottom: 1.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
}

.btn-primary.btn-block {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    height: 48px;
    font-size: 1rem;
    font-weight: 700;
}

.btn-primary.btn-block:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.login-footer-text {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.login-footer-text a {
    color: var(--primary-color);
    font-weight: 600;
}

.login-footer-text a:hover {
    text-decoration: underline;
}

/* assets/css/style.css enhancements */

.mobile-only {
    display: none !important;
}

.desktop-only {
    display: block !important;
}

@media (max-width: 1024px) {
    .mobile-only {
        display: block !important;
    }

    .desktop-only {
        display: none !important;
    }
}

/* Bottom Navigation (Mobile Only) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: none;
    justify-content: space-around;
    align-items: center;
    padding: 0.65rem 0.25rem;
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 600;
    flex: 1;
    text-decoration: none;
    transition: all 0.15s;
}

.bottom-nav-item i {
    font-size: 1.1rem;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item:active {
    transform: scale(0.92);
}

/* Add padding to the bottom of the content-wrapper on mobile to account for bottom-nav */
@media (max-width: 1024px) {
    .bottom-nav {
        display: flex;
    }

    .content-wrapper {
        padding-bottom: 5rem !important;
        /* Extra space for bottom nav */
    }

    .main-content {
        padding-bottom: 1.5rem;
    }
}

/* Global mobile tweaks */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
    }

    .card {
        padding: 1rem !important;
        margin-bottom: 1rem;
    }
}