/* =============================================== */
/* 1. Global Styles & Variables                    */
/* =============================================== */

:root {
    --primary-color: #0d6efd; /* Bootstrap Primary Blue */
    --secondary-color: #6c757d; /* Bootstrap Secondary Gray */
    --light-gray: #f8f9fa;
    --dark-gray: #343a40;
    --border-color: #dee2e6;
    --font-family-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;

    /* Light Theme Defaults */
    --background-color: #ffffff;
    --content-bg: #ffffff;
    --text-color: #212529;
    --text-muted: #6c757d;
    --light-bg: #f8f9fa;
    --link-hover-color: #0a58ca;
    --success-color: #198754;
    --danger-color: #dc3545;
}

body {
    font-family: var(--font-family-sans-serif);
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.2s linear, color 0.2s linear;
}

h1, h2, h3 {
    color: var(--text-color);
}

a {
    color: var(--primary-color);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}


/* =============================================== */
/* 2. Layout & Main Container                      */
/* =============================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    flex-wrap: wrap; /* Allow header content to wrap */
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap; /* Allow nav links to wrap */
    justify-content: flex-end; /* Align links to the right when they wrap */
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0;
}


/* =============================================== */
/* 3. Authentication Forms (Login/Register)        */
/* =============================================== */

.auth-container {
    max-width: 450px;
    margin: 4rem auto;
    padding: 2rem;
    background-color: var(--content-bg);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}


/* =============================================== */
/* 4. Flash Messages (Alerts)                      */
/* =============================================== */

.flash-message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    border: 1px solid transparent;
    background-color: #f8d7da;
    color: #842029;
    border-color: #f5c2c7;
}


/* =============================================== */
/* 5. History Page Styles                          */
/* =============================================== */

.ticket-card {
    background-color: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s ease-in-out, background-color 0.2s linear;
}

.ticket-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.list-item-header a {
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--primary-color);
}

.list-item-header a:hover {
    text-decoration: underline;
}

.list-item-summary {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.list-item-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: right;
}

/* =============================================== */
/* 6. Dark Mode Theme Variables                    */
/* =============================================== */

[data-theme="dark"] {
    /* Main background and text colors */
    --background-color: #212529; /* Dark Gray */
    --content-bg: #2b3035;       /* Slightly lighter dark for cards */
    --text-color: #dee2e6;       /* Light gray text */
    --text-muted: #adb5bd;       /* Muted light gray text */

    /* Borders and Dividers */
    --border-color: #495057;
    
    /* Special background for highlighted areas */
    --light-bg: #343a40;

    /* Link and Accent Colors */
    --link-hover-color: #3b8aff;
}

/* =============================================== */
/* 7. Navigation Button Styles                     */
/* =============================================== */

.nav-links a {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
    background-color: var(--content-bg);
    border: 1px solid var(--border-color);
    transition: background-color 0.2s ease, transform 0.1s ease;
    font-weight: 500;
    text-align: center;
}

.nav-links a:hover {
    background-color: var(--light-bg);
    transform: translateY(-2px); /* Adds a subtle lift effect */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Special styling for the Sign Out button to make it stand out */
.nav-links a[href*="logout"] {
    background-color: transparent;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.nav-links a[href*="logout"]:hover {
    background-color: var(--danger-color);
    color: #ffffff; /* White text on hover for contrast */
}