:root {
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
    --primary-color: #6366f1;
    --secondary-color: #334155;
    --accent-color: #22d3ee;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Effect */
.background-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 120vw;
    height: 120vh;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.15), rgba(15, 23, 42, 0) 70%);
    transform: translate(-50%, -50%);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(90deg, #818cf8, #22d3ee);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
}

/* Panels */
.glass-panel {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-header h2 {
    font-size: 1.25rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary-color), #4f46e5);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
}

.btn.secondary {
    background: var(--secondary-color);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn.secondary:hover {
    background: #475569;
    color: white;
}

.btn.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn.warning {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.btn.warning:hover {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
}

.btn.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn.success:hover {
    background: rgba(16, 185, 129, 0.2);
}

.btn.small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Forms */
input[type="text"],
input[type="number"],
input[type="url"],
input[type="password"],
select {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0.6rem;
    color: white;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

option {
    background-color: #1e293b;
    color: white;
}

input:focus {
    border-color: var(--primary-color);
}

.add-video-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.add-video-form input {
    flex: 1;
}

/* Groups Grid */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.group-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

.group-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.group-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Videos List */
.video-item {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1rem;
    overflow: hidden;
}

.video-header-row {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}

.video-header-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.video-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
}

.expand-icon {
    transition: transform 0.3s;
    color: var(--text-muted);
}

.video-item.open .expand-icon {
    transform: rotate(180deg);
}

.video-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.video-body.expanded {
    max-height: 2000px;
    /* Arbitrary large height */
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Video Inner Layout */
.video-info-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
}

.time-box {
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem;
    border-radius: 6px;
}

.time-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.time-value {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.video-summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    align-items: center;
}

.stats-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.stat-badge.scheduled {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.stat-badge.review {
    background: rgba(234, 179, 8, 0.15);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.stat-badge.verified {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.stat-badge.total {
    background: rgba(167, 139, 250, 0.15);
    color: #c4b5fd;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.stat-badge.overdue {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.section-title {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.2rem;
}

/* Group Checkboxes */
.group-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.group-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.group-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.group-option.selected {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    color: #e0e7ff;
}

/* Members Grid */
.video-member-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
}

.member-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.member-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

.member-card.purchased {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.member-card.scheduled {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.member-card.pending-review {
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(234, 179, 8, 0.4);
}

.member-card.pending-review .status span {
    color: #facc15 !important;
}

.member-card.overdue {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.member-card.overdue .status span {
    color: #fca5a5 !important;
    font-weight: 600;
}

.member-card .name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.member-card .status {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.video-search-bar {
    position: relative;
    margin-bottom: 1rem;
}

.video-search-bar input {
    background: rgba(0, 0, 0, 0.3);
    border-color: transparent;
    padding-left: 2.2rem;
}

.video-search-bar i {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.action-buttons-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Custom Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none !important;
    /* Force hide */
}

.modal-content {
    background: #1e293b;
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* Fix Overflow */
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Ensure table container scrolls nicely within available space if using flex column */
.modal-content .table-container {
    overflow-y: auto;
    /* Optional: custom scrollbar styling could go here */
}

.form-row {
    margin-bottom: 1rem;
}

.form-row label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.members-list {
    list-style: none;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 1rem;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* UPDATED VIDEO CONTROLS */
.video-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.day-badge {
    background: linear-gradient(135deg, #4f46e5, #818cf8);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(99, 102, 241, 0.4);
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.video-controls .delete-vid {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(239, 68, 68, 0.2);
    transition: all 0.2s;
    font-size: 0.9rem;
}

.video-controls .delete-vid:hover {
    background: #ef4444;
    color: white;
    transform: rotate(90deg);
}

/* PROJECTION TABLE */
#projectionTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

#projectionTable th {
    text-align: left;
    padding: 0.5rem;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#projectionTable td {
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
}

.buyer-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin: 2px;
}

.buyer-pill.draggable {
    cursor: grab;
    user-select: none;
    transition: transform 0.1s;
}

.buyer-pill.draggable:active {
    cursor: grabbing;
    transform: scale(1.05);
}

.projection-drop-zone.drag-over {
    background: rgba(99, 102, 241, 0.15) !important;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(99, 102, 241, 0.2);
}

.btn-action-vid {
    flex: 1;
    background: rgba(79, 70, 229, 0.1);
    color: #818cf8;
    border: 1px dashed rgba(79, 70, 229, 0.3);
    padding: 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-action-vid:hover {
    background: rgba(79, 70, 229, 0.2);
    color: #a5b4fc;
}

/* TRASH ZONE STYLES */
.trash-zone {
    flex: 1;
    margin: 0 1.5rem;
    padding: 0.5rem;
    border: 2px dashed rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.05);
    min-height: 60px;
    max-height: 120px;
    overflow-y: auto;
    transition: all 0.2s;
    text-align: center;
}

.trash-zone.drag-over {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    transform: scale(1.02);
}

.trash-header {
    font-size: 0.8rem;
    color: #fca5a5;
    font-weight: bold;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.trash-names {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.trash-pill {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 8px;
    cursor: grab;
}

.trash-pill:active {
    cursor: grabbing;
}

/* Auth Specifics */
.input-with-icon {
    position: relative;
    width: 100%;
}

.input-with-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
}

.input-with-icon input:focus+i,
.input-with-icon input:focus~i {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    /* Stack Video Stats Vertical */
    .video-info-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    /* Adjust Header */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-controls {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    #backupControls {
        align-items: flex-start !important;
        /* Move to left on mobile */
        width: 100%;
        margin-right: 0 !important;
        margin-bottom: 1rem;
    }

    /* Stack User inputs */
    .form-row {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Modal Full Width */
    .modal-content {
        max-width: 95%;
        padding: 1.5rem;
        max-height: 90vh;
        /* Prevent overflow */
        overflow-y: auto;
    }

    /* Bigger Buttons for Touch */
    .btn {
        padding: 0.8rem 1rem;
    }

    /* Input Text Size (Prevent Zoom on iOS) */
    input[type="text"],
    input[type="number"],
    input[type="password"],
    input[type="url"],
    select {
        font-size: 16px;
    }

    /* Make Projection Table Scrollable */
    #projectionTable {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
/* REJECTED & REVERTED CARD STYLES */
.member-card.rejected {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.member-card.rejected .status span {
    color: #ef4444 !important;
}

.member-card.reverted {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.member-card.reverted .status span {
    color: #f59e0b !important;
}

/* PINK STYLE FOR REVERTED */
.member-card.reverted {
    background: rgba(236, 72, 153, 0.15) !important;
    border: 1px solid rgba(236, 72, 153, 0.4) !important;
}
.member-card.reverted .status span {
    color: #f472b6 !important;
}

/* --- ZOOM ON HOVER --- */
#proofPreviewArea {
    overflow: hidden;
    cursor: crosshair;
    position: relative;
}

#proofPreviewImg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
    will-change: transform;
}

#proofPreviewArea:hover #proofPreviewImg,
#proofPreviewArea.is-touch-zooming #proofPreviewImg {
    transform: scale(2.5);
}

/* Ensure buttons stay on top of zoomed image */
#proofPreviewArea button {
    z-index: 20;
}
