@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --background: #09090b;
    --foreground: #fafafa;
    --card: #111113;
    --card-foreground: #fafafa;
    --popover: #111113;
    --popover-foreground: #fafafa;
    --primary: #fafafa;
    --primary-foreground: #18181b;
    --secondary: #1e1e24;
    --secondary-foreground: #fafafa;
    --muted: #1e1e24;
    --muted-foreground: #a1a1aa;
    --accent: #27272a;
    --accent-foreground: #fafafa;
    --destructive: #ef4444;
    --destructive-foreground: #fafafa;
    --border: #27272a;
    --input: #27272a;
    --ring: #71717a;
    --radius: 0.75rem;
}

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

body {
    background-color: var(--background);
    color: var(--foreground);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    border-bottom: 1px solid var(--border);
    background-color: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    color: var(--foreground);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: #18181b;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--foreground);
    flex-shrink: 0;
}

/* Search Bar */
.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 28rem;
}

.search-input {
    width: 100%;
    height: 2.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background-color: rgba(24, 24, 27, 0.6);
    padding: 0 2.25rem 0 2.25rem;
    font-size: 0.875rem;
    color: var(--foreground);
    transition: all 0.15s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--ring);
    background-color: rgba(24, 24, 27, 0.9);
}

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

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.search-kbd {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    border: 1px solid var(--border);
    background-color: #18181b;
    color: var(--muted-foreground);
    border-radius: 0.25rem;
    padding: 0.1rem 0.35rem;
    font-size: 0.7rem;
    font-family: inherit;
    pointer-events: none;
}

/* Nav Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    height: 2.25rem;
    padding: 0 0.875rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: #e4e4e7;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--foreground);
}

.btn-outline:hover {
    background-color: var(--accent);
}

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

.btn-secondary:hover {
    background-color: #2e2e36;
}

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

/* Header Section */
.page-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--foreground);
}

.page-subtitle {
    font-size: 0.95rem;
    color: var(--muted-foreground);
}

/* Union Toolbar */
.union-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.game-count {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cdn-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: #a1a1aa;
    background-color: rgba(24, 24, 27, 0.6);
    border: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-family: inherit;
}

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background-color: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
    display: inline-block;
}

/* Card Actions */
.card-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.btn-sm {
    height: 1.85rem;
    font-size: 0.75rem;
    padding: 0 0.65rem;
    border-radius: 0.375rem;
}

.btn-cdn {
    background-color: rgba(39, 39, 42, 0.6);
    color: var(--muted-foreground);
    border: 1px solid var(--border);
    font-family: monospace;
    font-size: 0.72rem;
}

.btn-cdn:hover {
    background-color: var(--accent);
    color: var(--foreground);
    border-color: #52525b;
}

.btn-cdn.copied {
    background-color: #15803d;
    color: #ffffff;
    border-color: #22c55e;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background-color: #18181b;
    border: 1px solid #3f3f46;
    color: #fafafa;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    pointer-events: auto;
    animation: toast-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

/* Game Card */
.card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.card:hover {
    transform: translateY(-3px);
    border-color: #3f3f46;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

.card-image-wrap {
    width: 100%;
    aspect-ratio: 16 / 10;
    position: relative;
    overflow: hidden;
    background-color: #18181b;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-img {
    transform: scale(1.04);
}

.card-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(9, 9, 11, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e4e4e7;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
}

.badge-featured {
    background-color: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
    color: #fbbf24;
}

.card-content {
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Modal / Theater Player */
.player-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 100;
    flex-direction: column;
}

.player-header {
    height: 3.5rem;
    padding: 0 1.5rem;
    background-color: #09090b;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.player-title-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
}

.player-badge {
    font-size: 0.75rem;
    background-color: var(--secondary);
    color: var(--muted-foreground);
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border);
}

.player-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background-color: #000;
}

/* ROM Dropzone Dialog */
.dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 150;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.dialog-box {
    width: 100%;
    max-width: 30rem;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

.dialog-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
}

.dialog-desc {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    line-height: 1.4;
}

.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--ring);
    background-color: rgba(39, 39, 42, 0.3);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    color: var(--muted-foreground);
    font-size: 0.95rem;
}
