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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-box h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: white;
    background: rgba(255, 255, 255, 0.2);
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: white;
    color: #764ba2;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.demo-credentials {
    text-align: center;
    margin-top: 20px;
    opacity: 0.7;
}

/* Dashboard */
.navbar {
    background: var(--bg-card);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-logout {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #ef4444;
    border-color: #ef4444;
}

.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.dashboard-header p {
    color: var(--text-muted);
}

.import-help {
    color: var(--text-muted);
    margin: 0.75rem 0 1rem;
    line-height: 1.5;
}

.import-help code {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.1rem 0.35rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border);
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.game-thumbnail {
    height: 150px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-icon {
    font-size: 4rem;
}

.game-info {
    padding: 1.5rem;
}

.game-info h3 {
    margin-bottom: 0.5rem;
}

.game-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.add-game .game-thumbnail {
    background: transparent;
    border: 2px dashed var(--border);
}

.add-game:hover .game-thumbnail {
    border-color: var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 1000px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.btn-close {
    background: none;
    border: none;
    color: var(--text);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.3s;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

#gameFrame {
    flex: 1;
    width: 100%;
    border: none;
    background: black;
}

/* Error Message */
.error-msg {
    background: #ef4444;
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.add-game-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.add-game-panel h2 {
    margin-bottom: 1rem;
}

.add-game-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

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

.field-group input {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #0b1220;
    color: var(--text);
}

.storage-note {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.card-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.btn-card {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
}

.btn-card:hover {
    border-color: var(--primary);
}

.btn-danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.empty-state {
    border: 1px dashed var(--border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}
