/* ==============================================================================
   24LIVEHOUSE Team Portal - Modern High-End Dark UI
   ============================================================================== */

:root {
    --bg-dark: #0a0b10;
    --bg-card: rgba(19, 22, 34, 0.75);
    --bg-card-hover: rgba(26, 31, 48, 0.9);
    --bg-surface: #131622;
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-active: rgba(59, 130, 246, 0.5);

    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --brand-blue: #3b82f6;
    --brand-blue-glow: rgba(59, 130, 246, 0.35);
    --brand-red: #ff2a5f;
    --brand-red-glow: rgba(255, 42, 95, 0.35);
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-purple: #8b5cf6;

    --font-sans: 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.25);
    --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(255, 42, 95, 0.08) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--brand-blue);
}

/* Glassmorphism helpers */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
}

/* Header & Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 11, 16, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    height: 38px;
    object-fit: contain;
}

.brand-tag {
    background: linear-gradient(135deg, var(--brand-red), #991b1b);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0.8rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
}

.user-role-pill {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-admin {
    background: rgba(255, 42, 95, 0.2);
    color: #ff4d7d;
    border: 1px solid rgba(255, 42, 95, 0.3);
}

.role-freelance {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Nav Tabs */
.nav-tabs-wrapper {
    background: rgba(19, 22, 34, 0.5);
    border-bottom: 1px solid var(--border-glass);
    padding: 0.5rem 1.5rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.nav-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
    color: #ffffff;
    background: var(--brand-blue);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.badge-count {
    background: var(--brand-red);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.85; }
    100% { transform: scale(1); opacity: 1; }
}

/* Main Container */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-blue), #1d4ed8);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #60a5fa, var(--brand-blue));
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--brand-red), #b91c1c);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-emerald), #047857);
    color: white;
}

.btn-success:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-claim {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000000;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

.btn-claim:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
    transform: scale(1.03);
}

/* Cards & Grids */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, var(--brand-blue-glow) 0%, transparent 70%);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h4 {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-info .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Control Bar (Filters & Actions) */
.control-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.input-field, .select-field {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
}

.input-field:focus, .select-field:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Timeline and Schedule Cards */
.timeline-date-header {
    margin: 1.5rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
}

.timeline-date-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-glass);
}

/* ==============================================================================
   Hourly Calendar Timetable Styles (24 Hours Day View)
   ============================================================================== */
.btn-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    border-radius: var(--radius-sm);
    gap: 0.25rem;
}

.team-cal-wrapper {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    margin-bottom: 2rem;
}

.team-cal-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.02);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.team-cal-date-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.team-cal-summary-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.team-cal-scroll-area {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 72vh;
    position: relative;
}

.team-cal-grid-table {
    display: flex;
    flex-direction: column;
    min-width: 900px;
    position: relative;
}

.team-cal-cols-header {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 25;
    background: #0d101a;
    border-bottom: 1px solid var(--border-glass);
}

.team-cal-time-corner {
    width: 80px;
    min-width: 80px;
    padding: 0.85rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
    border-right: 1px solid var(--border-glass);
    position: sticky;
    left: 0;
    background: #0d101a;
    z-index: 30;
}

.team-cal-studio-header {
    flex: 1;
    min-width: 270px;
    padding: 0.85rem 1rem;
    border-right: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.92rem;
    background: #0d101a;
}

.team-cal-studio-header:last-child {
    border-right: none;
}

/* 24 Hours x 60px = 1440px Body */
.team-cal-body {
    display: flex;
    position: relative;
    height: 1440px;
}

.team-cal-time-axis {
    width: 80px;
    min-width: 80px;
    height: 1440px;
    position: sticky;
    left: 0;
    z-index: 20;
    background: rgba(13, 16, 26, 0.96);
    backdrop-filter: blur(8px);
    border-right: 1px solid var(--border-glass);
    user-select: none;
}

.team-cal-time-slot-label {
    height: 60px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
}

.team-cal-studios-track {
    flex: 1;
    display: flex;
    position: relative;
    height: 1440px;
}

.team-cal-studio-track {
    flex: 1;
    min-width: 270px;
    height: 1440px;
    position: relative;
    border-right: 1px solid var(--border-glass);
}

.team-cal-studio-track:last-child {
    border-right: none;
}

/* Hour cells */
.team-cal-hour-cell {
    height: 60px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    box-sizing: border-box;
    position: relative;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.team-cal-hour-cell:nth-child(even) {
    background: rgba(255, 255, 255, 0.01);
}

.team-cal-hour-cell:hover {
    background: rgba(59, 130, 246, 0.06);
}

.team-cal-hour-cell .cell-add-session-btn {
    display: none;
    font-size: 0.72rem;
    color: var(--brand-blue);
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.team-cal-hour-cell:hover .cell-add-session-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.team-cal-hour-cell .cell-add-session-btn:hover {
    background: var(--brand-blue);
    color: white;
}

/* Session Card in Timetable */
.team-cal-session-card {
    position: absolute;
    left: 4px;
    right: 4px;
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    box-sizing: border-box;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-left-width: 5px;
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
    cursor: pointer;
}

.team-cal-session-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
    z-index: 15;
}

.team-cal-session-card.claimable {
    border-left-color: #f59e0b !important;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(19, 22, 34, 0.96));
    border-color: rgba(245, 158, 11, 0.4);
}

.team-cal-session-card.myshift {
    border-left-color: var(--accent-emerald) !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(19, 22, 34, 0.96));
    border-color: rgba(16, 185, 129, 0.4);
}

.team-cal-now-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--brand-red);
    box-shadow: 0 0 10px var(--brand-red), 0 0 4px var(--brand-red);
    z-index: 22;
    pointer-events: none;
}

.team-cal-now-badge {
    position: absolute;
    left: 4px;
    top: -11px;
    background: var(--brand-red);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.6);
}

.sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.session-card {
    padding: 1.25rem;
    border-radius: var(--radius-md);
    position: relative;
    border-left: 4px solid var(--brand-blue);
    transition: var(--transition);
}

.session-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
    background: var(--bg-card-hover);
}

.session-card.claimable {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(19, 22, 34, 0.9));
}

.session-card.completed {
    border-left-color: var(--accent-emerald);
    opacity: 0.85;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.session-time {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.session-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-platform {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.badge-studio {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.session-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.35rem;
}

.session-title {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.session-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-glass);
    margin-top: 0.5rem;
}

.session-staff {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.session-wage {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-amber);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: #131622;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Tables (Payroll & Team) */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: #1c2033;
    border: 1px solid var(--border-glass);
    color: white;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.88rem;
    min-width: 280px;
    animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success {
    border-left: 4px solid var(--accent-emerald);
}

.toast.toast-error {
    border-left: 4px solid var(--brand-red);
}

.toast.toast-info {
    border-left: 4px solid var(--brand-blue);
}

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .topbar {
        padding: 0.75rem 1rem;
    }
    .brand-title {
        font-size: 0.95rem;
    }
    .main-content {
        padding: 1rem;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .sessions-grid {
        grid-template-columns: 1fr;
    }
}
