/* Modern App Style CSS */

/* --- CSS Variables for Design System --- */
:root {
    /* Colors */
    --primary-color: #8b5cf6; /* A vibrant purple */
    --primary-hover: #7c3aed; /* Darker purple */
    --primary-light: #a78bfa; /* Lighter purple */
    --secondary-color: #64748b; /* Already good for muted elements */
    --success-color: #22c55e; /* Green */
    --danger-color: #ef4444; /* Red */
    --warning-color: #f59e0b; /* Yellow/Orange */
    --info-color: #3b82f6;   /* Blue */

    /* Backgrounds */
    --bg-primary: #0f172a; /* Deep dark blue */
    --bg-secondary: #1e293b; /* Slightly lighter dark blue */
    --bg-tertiary: #334155; /* Even lighter dark blue for distinct elements */
    --bg-surface: #1a202c; /* Main card/content background */
    --bg-surface-elevated: #2d3748; /* For hover states or slightly elevated cards */
    --bg-overlay: rgba(0, 0, 0, 0.8); /* Darker overlay */

    /* Text Colors */
    --text-primary: #e2e8f0; /* Light grey for main text */
    --text-secondary: #a0aec0; /* Muted grey for secondary text */
    --text-muted: #718096; /* Even more muted grey */
    --text-inverse: #0f172a; /* Dark text on light backgrounds (not used much in dark theme) */
    --text-on-primary: #ffffff; /* White text on primary color */

    /* Borders */
    --border-color: #4a5568; /* Darker, less intrusive borders */
    --border-hover: #616e7f;
    --border-focus: var(--primary-color);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.25);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Transitions */
    --transition-fast: 150ms ease-out;
    --transition-normal: 250ms ease-out;
    --transition-slow: 350ms ease-out;
}

/* --- Reset & Base --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background: var(--bg-primary); /* Use primary dark background */
    min-height: 100vh;
    color: var(--text-primary); /* Primary text color */
    padding-top: 80px;
    padding-bottom: 60px;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Modern Container --- */
.container {
    background: var(--bg-surface); /* Main content background */
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color); /* Darker border */
    padding: var(--space-2xl);
    margin: var(--space-xl) auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl); /* Darker shadows */
    max-width: 1200px;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent); /* Subtle light line */
}

/* --- Modern Typography --- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary); /* Primary text color for headings */
    margin-bottom: 0.75em;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.025em;
}

h2 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color)); /* Lighter gradient for dark mode headings */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-xl);
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-light), var(--primary-color)); /* Lighter gradient */
    border-radius: var(--radius-sm);
}

p {
    margin-bottom: var(--space-md);
    color: var(--text-secondary); /* Secondary text color */
}

a {
    color: var(--primary-light); /* Lighter primary color for links */
    text-decoration: none;
    transition: all var(--transition-fast);
    position: relative;
}

a:hover {
    color: var(--primary-color); /* Primary color on hover */
    transform: translateY(-1px);
}

/* --- Modern Header --- */
.site-header {
    background: var(--bg-secondary); /* Darker header background */
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color); /* Darker border */
    color: var(--text-primary); /* Primary text color */
    padding: var(--space-md) 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: var(--shadow-lg); /* Darker shadow */
}

.site-header .header-inner-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.site-header h1 {
    color: var(--text-primary); /* Primary text color for h1 */
    margin-bottom: 0;
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-light)); /* Gradient for header title */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-header h1 a.header-title-link {
    color: inherit;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.site-header h1 a.header-title-link:hover {
    transform: scale(1.02);
}

.site-header h1 i {
    margin-right: var(--space-sm);
    color: var(--primary-light);
    filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.5)); /* Adjusted shadow for new primary color */
}

/* --- Modern Hamburger Menu --- */
.hamburger-menu {
    background: none;
    border: none;
    color: var(--text-primary); /* Primary text color */
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.hamburger-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.05); /* Subtle white overlay for hover */
    border-radius: var(--radius-md);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.hamburger-menu:hover::before {
    opacity: 1;
}

.hamburger-menu:hover {
    transform: scale(1.05);
}

/* --- Modern Navigation --- */
.site-header .main-nav {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--bg-tertiary); /* Lighter dark background for nav */
    backdrop-filter: blur(20px);
    min-width: 250px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    padding: var(--space-md);
    z-index: 999;
    transform: translateY(-10px);
    opacity: 0;
    transition: all var(--transition-normal);
}

.site-header .main-nav.active {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

.site-header .main-nav a {
    color: var(--text-primary); /* Primary text color for nav links */
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xs);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.site-header .main-nav a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.site-header .main-nav a:hover::before,
.site-header .main-nav a.active-nav-item::before {
    opacity: 1;
}

.site-header .main-nav a:hover,
.site-header .main-nav a.active-nav-item {
    color: var(--text-on-primary); /* White text on primary background */
    transform: translateX(4px);
}

.site-header .main-nav a i {
    margin-right: var(--space-md);
    width: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.site-header .main-nav a span {
    position: relative;
    z-index: 1;
}

/* --- Modern Flash Messages --- */
.flash-messages-wrapper {
    max-width: 1200px;
    margin: var(--space-xl) auto;
    padding: 0 var(--space-xl);
}

.flash-messages {
    list-style-type: none;
    padding: 0;
}

.flash-messages li {
    padding: var(--space-lg) var(--space-xl);
    margin-bottom: var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color); /* Darker border */
    color: var(--text-primary); /* Primary text color */
}

.flash-messages li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    transition: width var(--transition-normal);
}

.flash-messages .success {
    background: rgba(34, 197, 94, 0.1); /* Subtle green background */
    color: var(--success-color); /* Green text */
    border-left-color: var(--success-color);
}
.flash-messages .success::before { background: var(--success-color); }

.flash-messages .error {
    background: rgba(239, 68, 68, 0.1); /* Subtle red background */
    color: var(--danger-color); /* Red text */
    border-left-color: var(--danger-color);
}
.flash-messages .error::before { background: var(--danger-color); }

.flash-messages .warning {
    background: rgba(245, 158, 11, 0.1); /* Subtle orange background */
    color: var(--warning-color); /* Orange text */
    border-left-color: var(--warning-color);
}
.flash-messages .warning::before { background: var(--warning-color); }

.flash-messages .info {
    background: rgba(59, 130, 246, 0.1); /* Subtle blue background */
    color: var(--info-color); /* Blue text */
    border-left-color: var(--info-color);
}
.flash-messages .info::before { background: var(--info-color); }

/* --- Modern Forms --- */
form {
    margin-top: var(--space-xl);
}

.form-group {
    margin-bottom: var(--space-xl);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary); /* Primary text color */
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: 100%;
    padding: var(--space-lg);
    border: 2px solid var(--border-color); /* Darker border */
    border-radius: var(--radius-lg);
    font-size: 1rem;
    line-height: 1.5;
    background-color: var(--bg-secondary); /* Darker input background */
    color: var(--text-primary); /* Primary text color for input */
    transition: all var(--transition-normal);
    position: relative;
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted); /* Muted placeholder text */
}


input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-light); /* Lighter primary color on focus */
    outline: 0;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1); /* Adjusted shadow for new primary color */
    transform: translateY(-1px);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* --- Modern Buttons --- */
button,
input[type="submit"],
.button,
a.button-style {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    cursor: pointer;
    border: none;
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all var(--transition-normal);
    user-select: none;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.025em;
    box-shadow: var(--shadow-md);
    color: var(--text-on-primary); /* Text on buttons should be white */
}

button::before,
.button::before,
a.button-style::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent); /* Subtle shine effect */
    transition: left var(--transition-slow);
}

button:hover::before,
.button:hover::before,
a.button-style:hover::before {
    left: 100%;
}

button:hover,
.button:hover,
a.button-style:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

button:active,
.button:active,
a.button-style:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.button-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: var(--text-on-primary);
}

.button-secondary,
a.cancel-link {
    background: var(--bg-tertiary); /* Darker grey for secondary buttons */
    color: var(--text-primary); /* Primary text color for secondary buttons */
    border: 1px solid var(--border-color);
}

.button-secondary:hover,
a.cancel-link:hover {
    background: #475569; /* Slightly darker on hover */
    color: var(--text-primary);
    text-decoration: none;
}

.button-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: var(--text-on-primary);
}

button i,
.button i {
    margin-right: var(--space-sm);
}

/* --- Modern Tables --- */
.table-responsive-wrapper {
    overflow-x: auto;
    margin-bottom: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    background: var(--bg-surface); /* Main surface for table container */
}

table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    background-color: var(--bg-surface);
}

table:not(.responsive-card-table) {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

th, td {
    padding: var(--space-lg);
    text-align: left;
    border-bottom: 1px solid var(--border-color); /* Darker border */
    vertical-align: middle;
}

thead th {
    background: var(--bg-tertiary); /* Darker header for table */
    color: var(--text-primary); /* Primary text color */
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
}

tbody tr {
    transition: all var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-surface-elevated); /* Elevated surface on hover */
    transform: scale(1.001);
}

/* Link Details specific for index.html table */
.title-cell {
    display: flex;
    align-items: center;
    justify-content: space-between; /* To push edit icon to the right */
}

.title-and-bonus {
    display: flex;
    flex-wrap: wrap; /* Allows bonus time to wrap on smaller screens */
    align-items: baseline;
}

.link-title-text {
    font-weight: 600;
    font-size: 1.1em;
    margin-right: var(--space-sm);
    white-space: nowrap; /* Prevent title from breaking lines too aggressively */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis for long titles */
    max-width: calc(100% - 70px); /* Adjust based on icon width */
}

.link-title-text:hover {
    text-decoration: underline;
}

.edit-link-icon {
    color: var(--text-muted); /* Muted icon color */
    font-size: 0.9em;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.edit-link-icon:hover {
    color: var(--primary-light); /* Lighter primary on hover */
    background-color: var(--bg-tertiary);
}

/* --- Modern Time Status --- */
.bonus-time-inline {
    font-size: 0.9em;
    font-weight: 500;
}

.time-status-upcoming {
    color: var(--success-color);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

.time-status-elapsed {
    color: var(--danger-color);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.time-status-n_a {
    color: var(--text-muted);
    font-style: italic;
}

/* --- Modern Pagination --- */
.pagination {
    margin-top: var(--space-2xl);
    text-align: center;
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    min-width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    color: var(--text-secondary); /* Secondary text color */
    text-decoration: none;
    transition: all var(--transition-fast);
    font-weight: 500;
    background: var(--bg-secondary); /* Darker background for pagination items */
    border: 1px solid var(--border-color);
}

.pagination a:hover {
    background: var(--primary-color);
    color: var(--text-on-primary); /* White text on hover */
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pagination .current {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: var(--text-on-primary); /* White text on current */
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

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

/* --- Modern Footer --- */
.site-footer {
    text-align: center;
    margin-top: var(--space-2xl);
    padding: var(--space-xl);
    background: var(--bg-secondary); /* Darker footer background */
    backdrop-filter: blur(10px);
    color: var(--text-muted); /* Muted text color */
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    :root {
        --space-xs: 0.125rem;
        --space-sm: 0.25rem;
        --space-md: 0.75rem;
        --space-lg: 1rem;
        --space-xl: 1.5rem;
        --space-2xl: 2rem;
    }

    body {
        padding-top: 70px;
    }

    .container {
        padding: var(--space-xl) var(--space-lg);
        margin: var(--space-md) var(--space-sm);
        border-radius: var(--radius-lg);
    }

    .site-header h1 {
        font-size: 1.25rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .site-header .main-nav {
        left: var(--space-sm);
        right: var(--space-sm);
        min-width: auto;
    }

    /* Card-style responsive tables */
    .table-responsive-wrapper {
        overflow-x: visible;
        box-shadow: none;
        background: transparent;
    }

    table.responsive-card-table {
        background-color: transparent;
        box-shadow: none;
    }

    table.responsive-card-table thead {
        display: none;
    }

    table.responsive-card-table tbody tr {
        display: block;
        margin-bottom: var(--space-xl);
        background: var(--bg-surface);
        border-radius: var(--radius-lg);
        padding: var(--space-xl);
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--border-color);
        position: relative;
        overflow: hidden;
    }

    table.responsive-card-table tbody tr::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, var(--primary-light), var(--primary-color)); /* Lighter gradient */
    }

    table.responsive-card-table tbody tr:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-xl);
    }

    table.responsive-card-table td {
        display: block;
        padding: var(--space-md) 0;
        border-bottom: 1px solid var(--border-color);
        font-size: 0.95rem;
        position: relative;
        text-align: left;
    }

    table.responsive-card-table td:last-of-type {
        border-bottom: none;
    }

    table.responsive-card-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-weight: 700;
        margin-bottom: var(--space-sm);
        color: var(--text-secondary); /* Secondary text for labels */
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .site-header h1 {
        font-size: 1.125rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .container {
        margin: var(--space-sm);
        padding: var(--space-lg);
    }
}

/* --- Modern Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.container {
    animation: fadeInUp 0.6s ease-out;
}

.flash-messages li {
    animation: fadeInUp 0.4s ease-out;
}

/* --- Utility Classes --- */
.text-center {
    text-align: center !important;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.05); /* Lighter glass effect */
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
