/* NHL Pool Manager - Main Styles */
/* Theme colors are dynamically injected via layout.php */

:root {
    /* Fallback colors if theme not loaded */
    --primary-color: #546A7B;
    --secondary-color: #6292BE;
    --accent-color: #C6C5B9;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #393D3F;
    --light-color: #FDFDF5;
    --border-color: #C6C5B9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9fafb;
}

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

/* Header & Navigation */
header {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand .logo {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

.navbar-menu a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.navbar-menu a:hover {
    opacity: 0.8;
}

/* Active/selected top menu item */
.navbar-menu a.active {
    font-weight: 700;
    /* default underline uses menu-highlight-color set by layout.php */
    box-shadow: inset 0 -3px 0 var(--menu-highlight-color, var(--accent-color));
    opacity: 1;
}

/* Also style links marked as current for accessibility */
.navbar-menu a[aria-current="page"] {
    font-weight: 700;
    box-shadow: inset 0 -3px 0 var(--accent-color);
}

.navbar-menu .btn-link {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-error {
    background-color: #fee2e2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: var(--warning-color);
    color: #92400e;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1e40af;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Responsive table wrapper for mobile horizontal scroll */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
}

.table th,
.table td {
    padding: 5px; /* updated per request */
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    /* revert to default inherited line-height and font-size */
}

/* Center text utility class */
.text-center {
    text-align: center !important;
}

/* Center optional columns */
.optional-col {
    text-align: center !important;
}

.table th {
    background: var(--light-color);
    font-weight: 600;
    /* Sticky headers disabled - using JavaScript fixed header implementation instead */
    position: static;
    top: auto;
    z-index: 1; /* keep below fixed header (z-index:999) */
}

/* Larger header text and increased padding per request */
.table thead th {
    font-size: 1rem; /* slightly larger than body cells (0.875rem) */
    padding: 10px; /* header-specific padding */
}

.table tr:hover {
    background: #f9fafb;
}

/* Footer */
.footer {
    background: var(--dark-color);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: row; /* keep logo left, burger right on same line */
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .navbar-menu {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }
    
    .table {
        font-size: 0.875rem;
    }
    /* Disable sticky table headers on small screens to avoid layout glitches */
    .table th {
        position: static;
        top: auto;
    }
    /* Increase tap target size for nav links */
    .navbar-menu a, .navbar-menu .btn-link {
        padding: 12px 14px;
    }
}

/* Tooltip for delta (1J,7J,30J) cells */
.delta { position: relative; display: inline-block; }
.delta[data-since]:hover::after {
    content: 'Since ' attr(data-since);
    position: absolute; right: 100%; top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,0.85); color: #fff; padding: 4px 6px; border-radius: 4px;
    font-size: 0.65rem; white-space: nowrap; z-index: 300;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    margin-right: 6px;
}
.delta[data-since]:hover::before {
    content: ''; position: absolute; top: 50%; right: calc(100% - 6px); transform: translateY(-50%);
    width: 0; height: 0; border: 6px solid transparent; border-left-color: rgba(0,0,0,0.85);
}

/* Live points badge */
.badge-live {
    display: inline-block;
    background: var(--secondary-color);
    color: #fff;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1;
    min-width: 26px;
    text-align: center;
}
.badge-live.value-zero { opacity: 0.5; }
.badge-live.value-positive { background: var(--success-color); }
.badge-live.value-negative { background: var(--danger-color); }
