:root {
    --bg-color: #f4f6f9;
    --card-bg: #ffffff;
    --text-color: #333333;
    --primary-color: #007bff;
    --border-color: #ddd;

    /* NEW: Specific color for Header Text in Light Mode */
    --header-text: #333333; /* Dark text for light background */
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-color: #e0e0e0;
    --primary-color: #4da3ff;
    --border-color: #444;

    /* NEW: Specific color for Header Text in Dark Mode */
    --header-text: #ffffff; /* White text for dark background */
}

/* Apply to all elements to handle padding correctly */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

/* RTL Support via Logical Properties */
body[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

.navbar {
    background-color: var(--card-bg);
    /* background-color: #E8E8E8; */
    color: var(--header-text);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links a {
    /* color: var(--text-color); */
    color: var(--header-text);
    text-decoration: none;
    margin-inline-start: 15px; /* Logical property: works for LTR and RTL */
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.card {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1rem;
}

input, select, button {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 4px;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
}

.logo-img {
    height: 40px;
    vertical-align: middle;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.dashboard-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: var(--text-color);
    display: block; /* Make the whole card clickable */
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.dashboard-card h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.dashboard-card p {
    margin-bottom: 0;
    opacity: 0.8;
    line-height: 1.5;
}

/* --- HAMBURGER MENU STYLES --- */

/* 1. Default: Hide the hamburger on Desktop */
.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    transition: all 0.3s;
}

/* 2. Mobile View (Tablets and Phones) */
@media (max-width: 768px) {
    .hamburger {
        display: flex; /* Show hamburger */
    }

    .nav-links {
        display: none; /* Hide links by default */
        flex-direction: column;
        width: 100%;
        background-color: var(--card-bg);
        position: absolute;
        top: 60px; /* Adjust based on your header height */
        left: 0;
        border-bottom: 2px solid var(--primary-color);
        padding: 10px 0;
        z-index: 1000;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    }

    /* The 'active' class will be added by JS to show the menu */
    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        margin: 10px 20px; /* Add spacing for touch targets */
        display: block;
        padding: 10px;
        border-bottom: 1px solid var(--border-color);
    }
}

/* --- PRINT STYLES --- */
@media print {
    /* 1. Hide non-essential elements */
    .navbar, 
    .no-print, 
    form, 
    button, 
    a.btn-primary, 
    .dashboard-grid {
        display: none !important;
    }

    /* 2. Hide the 'Actions' column in tables (Last Header & Last Data Cell) */
    th:last-child, td:last-child {
        display: none !important;
    }

    /* 3. Reset Layout for Paper */
    body, .card, .container {
        background: white;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border: none;
        width: 100%;
        max-width: 100%;
    }

    /* 4. Ensure Table Borders are Black/Crisp */
    table, th, td {
        border: 1px solid black !important;
        border-collapse: collapse !important;
        color: black !important;
    }
    
    /* 5. Add a Title for the Printout */
    .card h2::after {
        content: " - " attr(data-date); /* Optional: could add date via JS */
        font-size: 0.8em;
    }
}