/* ================================
   Histoury Admin Dashboard Styles
   Modern Dark Theme with Glassmorphism
   ================================ */

/* CSS Variables */
:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(25, 25, 35, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;

    --accent-primary: #7c3aed;
    --accent-secondary: #a855f7;
    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #ec4899 100%);

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.3);

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 80px;
    --radius: 16px;
    --radius-sm: 8px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Layout */
.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    font-size: 32px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-img {
    max-width: 100%;
    height: auto;
    max-height: 50px;
}

.nav-tabs {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.nav-tab:hover:not(:disabled) {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

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

.nav-icon {
    font-size: 20px;
}

.badge {
    margin-left: auto;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-playfab-id {
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'Monaco', 'Consolas', monospace;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-currency {
    display: flex;
    align-items: center;
    gap: 6px;
}

.currency-icon {
    font-size: 16px;
}

.currency-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
}

.currency-label {
    font-size: 12px;
    color: var(--text-muted);
}

.version {
    font-size: 12px;
    color: var(--text-muted);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: var(--error);
    font-size: 14px;
    text-decoration: none;
    margin-bottom: 12px;
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    color: var(--text-secondary);
}

.select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.select:hover,
.select:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.search-box {
    position: relative;
}

.search-input {
    padding: 10px 16px;
    padding-left: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    width: 250px;
    transition: var(--transition);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}

/* Stats Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--accent-primary);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Venues Grid */
.venues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
}

/* Venue Card */
.venue-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.venue-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--accent-primary);
}

.venue-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.venue-title {
    font-size: 18px;
    font-weight: 600;
}

.venue-city {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 10px;
    background: var(--bg-glass);
    border-radius: 20px;
}

.venue-badges {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.venue-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.venue-badge.testing {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.venue-badge.geo {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

/* Image Grid */
.venue-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    padding: 2px;
}

.venue-image-item {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-secondary);
}

.venue-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.venue-image-item:hover img {
    transform: scale(1.1);
}

.venue-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    font-size: 11px;
    font-weight: 500;
    opacity: 0;
    transition: var(--transition);
}

.venue-image-item:hover .venue-image-overlay {
    opacity: 1;
}

.no-images {
    grid-column: 1 / -1;
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    opacity: 0.7;
    transition: var(--transition);
}

.modal-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.modal-image {
    max-width: 100%;
    max-height: 60vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    object-fit: contain;
}

/* Venue Detail Modal */
.venue-detail-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
}

.modal-layout {
    display: flex;
    max-height: 85vh;
}

.modal-image-section {
    flex: 1;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    min-width: 400px;
}

.modal-image-nav {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.modal-image-nav img {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
    border: 2px solid transparent;
}

.modal-image-nav img:hover,
.modal-image-nav img.active {
    opacity: 1;
    border-color: var(--accent-primary);
}

.modal-info-section {
    width: 380px;
    padding: 24px;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
}

.modal-info-section h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.modal-city {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.modal-city::before {
    content: '📍';
}

.venue-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.detail-item {
    background: var(--bg-glass);
    padding: 12px;
    border-radius: var(--radius-sm);
}

.detail-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
}

.detail-value.success {
    color: var(--success);
}

.detail-value.error {
    color: var(--error);
}

.venue-ids-section {
    margin-bottom: 24px;
}

.venue-ids-section h4,
.venue-images-list h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.id-item {
    margin-bottom: 12px;
}

.id-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.id-value {
    display: block;
    font-size: 12px;
    background: var(--bg-glass);
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--accent-secondary);
    word-break: break-all;
    font-family: 'Monaco', 'Consolas', monospace;
}

.venue-images-list ul {
    list-style: none;
}

.venue-images-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.venue-images-list li:hover {
    color: var(--accent-secondary);
}

.venue-images-list li:last-child {
    border-bottom: none;
}

.venue-images-list .img-icon {
    font-size: 16px;
}

.venue-images-list .img-label {
    flex: 1;
}

.venue-images-list .img-status {
    font-size: 11px;
    color: var(--success);
}

/* Responsive modal */
@media (max-width: 900px) {
    .modal-layout {
        flex-direction: column;
    }

    .modal-image-section {
        min-width: unset;
        max-height: 50vh;
    }

    .modal-info-section {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
}

/* Loading */
.loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Tab Content */
.tab-content {
    animation: fadeIn 0.3s ease;
}

.tab-content.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Coming Soon */
.coming-soon {
    text-align: center;
    padding: 80px 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.coming-soon-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 24px;
}

.coming-soon h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.coming-soon p {
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto;
}

/* Stats Detail */
.stats-detail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.stats-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
}

.stats-section h3 {
    font-size: 18px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.stats-list {
    list-style: none;
}

.stats-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.stats-list li:last-child {
    border-bottom: none;
}

.stats-list .label {
    color: var(--text-secondary);
}

.stats-list .value {
    font-weight: 600;
    color: var(--accent-secondary);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .logo-text,
    .nav-tab span:not(.nav-icon),
    .badge,
    .sidebar-footer {
        display: none;
    }

    .logo {
        justify-content: center;
    }

    .nav-tab {
        justify-content: center;
        padding: 14px;
    }

    .main-content {
        margin-left: 80px;
    }

    .venues-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .search-input {
        width: 100%;
    }

    .venues-grid {
        grid-template-columns: 1fr;
    }

    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ================================
   URL Editing Styles
   ================================ */

.url-item {
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

.url-item:last-child {
    border-bottom: none;
}

.url-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    cursor: pointer;
    transition: var(--transition);
}

.url-item-header:hover {
    color: var(--accent-secondary);
}

.url-item-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 10px 0;
}

.url-display {
    flex: 1;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'Monaco', 'Consolas', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-note {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.url-input {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 11px;
    font-family: 'Monaco', 'Consolas', monospace;
    transition: var(--transition);
}

.url-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.url-input[readonly] {
    opacity: 0.7;
    cursor: default;
}

.url-input.editing {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    opacity: 1;
}

.url-input.saved {
    border-color: var(--success);
    animation: saveFlash 1.5s ease;
}

@keyframes saveFlash {

    0%,
    100% {
        background: var(--bg-glass);
    }

    50% {
        background: rgba(16, 185, 129, 0.2);
    }
}

.url-actions {
    display: flex;
    gap: 4px;
}

.btn-small {
    padding: 6px 8px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-small:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
}

.btn-replace {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

.btn-replace:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
}

.btn-icon {
    padding: 4px 6px;
    font-size: 14px;
    margin-left: 8px;
    vertical-align: middle;
}

.venue-images-list h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ================================
   S3 Browser Modal Styles
   ================================ */

.s3-browser-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    width: 90vw;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.s3-browser-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.s3-browser-header h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.s3-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 13px;
}

.s3-breadcrumb button {
    background: var(--bg-glass);
    border: none;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.s3-breadcrumb button:hover,
.s3-breadcrumb button.active {
    background: var(--accent-primary);
    color: white;
}

.s3-quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-glass);
}

.quick-nav-btn {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.quick-nav-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.s3-files-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    align-content: start;
}

.s3-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    min-height: 100px;
}

.s3-item:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.s3-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.s3-name {
    font-size: 11px;
    color: var(--text-secondary);
    word-break: break-all;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.s3-file.is-image {
    background-size: cover;
    background-position: center;
    position: relative;
}

.s3-file.is-image .s3-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 8px 4px 4px;
    color: white;
}

.s3-upload-section {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-glass);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--accent-primary);
    background: rgba(124, 58, 237, 0.1);
}

.upload-dropzone span {
    font-size: 32px;
    margin-bottom: 8px;
}

.upload-dropzone p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* Responsive S3 Browser */
@media (max-width: 600px) {
    .s3-browser-modal {
        width: 95vw;
        max-height: 90vh;
    }

    .s3-files-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .s3-quick-nav {
        padding: 8px 16px;
    }
}

/* ================================
   Venue Edit Form Styles
   ================================ */

.modal-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.modal-header-row h2 {
    margin-bottom: 4px;
}

.btn-edit {
    white-space: nowrap;
    font-size: 13px;
    padding: 8px 16px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
}

.venue-edit-form {
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 24px;
}

.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.form-row-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.form-row-group .form-row {
    margin-bottom: 0;
}

.form-row-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.checkbox-label:hover {
    color: var(--text-primary);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* ================================
   IAP Grid Styles
   ================================ */

.iap-grid {
    /* Container for IAP content - grid is applied by iap-bundles-grid inside */
}

.iap-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.iap-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.iap-preview {
    position: relative;
    min-height: 150px;
    max-height: 300px;
    background: var(--bg-primary);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.iap-preview video,
.iap-preview img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
}

.iap-preview video {
    cursor: pointer;
}

.iap-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.iap-badge.video {
    background: rgba(124, 58, 237, 0.8);
    color: white;
}

.iap-badge.image {
    background: rgba(16, 185, 129, 0.8);
    color: white;
}

.iap-info {
    padding: 16px;
}

.iap-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: capitalize;
}

.iap-filename {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'Monaco', 'Consolas', monospace;
    margin-bottom: 12px;
    word-break: break-all;
}

.iap-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 768px) {
    .iap-grid {
        grid-template-columns: 1fr;
    }
}

/* IAP Preview Modal */
.iap-preview-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.iap-preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    min-height: 300px;
    max-height: 70vh;
}

.iap-preview-content video,
.iap-preview-content img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.iap-preview-content video {
    width: auto;
    height: auto;
}

.iap-preview-info {
    padding: 20px 24px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.iap-preview-info h3 {
    font-size: 18px;
    font-weight: 600;
    text-transform: capitalize;
    margin-bottom: 4px;
}

.iap-preview-info p {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'Monaco', 'Consolas', monospace;
}

/* Affiliates / Crew Members Tab */
.affiliates-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
}

.affiliates-form-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.affiliates-form-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 18px;
}

.affiliates-list-container {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-height: 400px;
}

.affiliates-list-container h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 18px;
}

.affiliates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.affiliate-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.affiliate-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
}

.affiliate-info code {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}

.affiliate-actions {
    display: flex;
    gap: 0.5rem;
}

/* ================================
   PlayFab IAP Bundles
   ================================ */

.iap-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Grid layout matching venues */
.iap-bundles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
    margin-bottom: 2rem;
}

.iap-packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* Bundle Card - matching venue-card */
.iap-bundle-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.iap-bundle-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--accent-primary);
}

/* Bundle Header - matching venue-header */
.bundle-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bundle-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.bundle-badges {
    display: flex;
    gap: 8px;
}

.bundle-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.bundle-badge.type {
    background: rgba(157, 78, 221, 0.2);
    color: var(--accent-primary);
}

.bundle-badge.discount {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.bundle-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bundle-tickets {
    font-size: 20px;
    font-weight: 700;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ticket-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.bundle-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--success);
    padding: 4px 10px;
    background: var(--bg-glass);
    border-radius: 20px;
}

/* Bundle Media - matching venue-images */
.bundle-media {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bundle-media img,
.bundle-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bundle-media .no-image {
    font-size: 2rem;
    opacity: 0.3;
    color: var(--text-muted);
}

/* Video badge */
.bundle-media .iap-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Bundle Footer - for replace button */
.bundle-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.bundle-footer .btn-replace {
    font-size: 12px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.bundle-footer .btn-replace:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Bundle edit modal */
.bundle-edit-modal {
    max-width: 450px;
}

.bundle-edit-modal h3 {
    margin-bottom: 1.5rem;
}

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

.video-filename {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.distribute-modal {
    max-width: 400px;
}
/* ================================
   Analytics Tab Styles
   ================================ */

.analytics-container {
    padding: 1rem 0;
}

.analytics-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.analytics-filters .form-input {
    flex: 1;
    max-width: 200px;
}

.analytics-table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
}

.analytics-table thead {
    background: var(--bg-secondary);
}

.analytics-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.analytics-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.analytics-table tr:hover {
    background: var(--bg-glass);
}

.analytics-table .loading,
.analytics-table .error,
.analytics-table .empty {
    text-align: center;
    padding: 2rem;
}

.player-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

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

.event-name {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg-glass);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.event-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* User Journey Modal */
.user-journey-modal {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.journey-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.journey-stats .stat-card {
    background: var(--bg-glass);
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.journey-timeline {
    max-height: 400px;
    overflow-y: auto;
}

.timeline-event {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-left: 2px solid var(--border-color);
    margin-left: 1rem;
    position: relative;
}

.timeline-event::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 1.5rem;
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
}

.timeline-time {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 150px;
}

.timeline-content {
    flex: 1;
}

.timeline-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.timeline-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.event-data {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.data-item {
    font-size: 0.75rem;
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: var(--text-secondary);
}
