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

:root {
    --primary: #8B5CF6;
    --primary-dark: #7C3AED;
    --secondary: #EC4899;
    --background: #0F172A;
    --surface: #1E293B;
    --surface-light: #334155;
    --text: #E2E8F0;
    --text-secondary: #94A3B8;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
}

body {
    background: linear-gradient(135deg, var(--background) 0%, #1a1f3a 100%);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.setup-section {
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
}

.setup-section h2 {
    color: var(--primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--surface-light);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-size: 1rem;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

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

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

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

input, textarea, select {
    width: 100%;
    padding: 12px;
    background: var(--surface-light);
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
    font-family: monospace;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

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

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

.btn-secondary:hover {
    background: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.games-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.game-card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-light) 100%);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
    position: relative;
}

.game-card:hover {
    border-color: var(--secondary);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.2);
    transform: translateY(-5px);
}

.game-card.borrowed {
    border-left: 4px solid var(--secondary);
}

.game-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text);
}

.game-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.info-item {
    padding: 8px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 6px;
}

.info-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.info-value {
    color: var(--primary);
    font-weight: 600;
    margin-top: 2px;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.status-available {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-borrowed {
    background: rgba(236, 72, 153, 0.2);
    color: var(--secondary);
}

.borrowed-info {
    background: rgba(236, 72, 153, 0.1);
    padding: 12px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 3px solid var(--secondary);
}

.borrowed-info strong {
    color: var(--secondary);
}

.card-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.card-actions button {
    flex: 1;
    padding: 10px;
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--text);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--primary);
}

.modal-content h3 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.search-box {
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.search-box input {
    margin: 0;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: var(--surface-light);
    border: 1px solid var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-light) 100%);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.instructions {
    background: rgba(139, 92, 246, 0.1);
    border-left: 4px solid var(--primary);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.instructions strong {
    color: var(--primary);
}

/* ---------- Login ---------- */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 40px);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: 16px;
    padding: 40px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.login-card h1 {
    font-size: 2rem;
}

.login-card .subtitle {
    margin-bottom: 32px;
}

.google-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    color: #1f1f1f;
    border: 1px solid #dadce0;
    font-weight: 500;
}

.google-btn:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.google-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-error {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ---------- Barra de usuario ---------- */
.user-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 20px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.user-text {
    text-align: right;
    line-height: 1.2;
}

.user-name {
    font-weight: 600;
}

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

.btn-small {
    padding: 8px 14px;
    font-size: 0.9rem;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.toolbar .filter-buttons {
    margin-bottom: 0;
}

/* ---------- BoardGameGeek ---------- */
.card-head {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-head-text {
    min-width: 0;
}

.card-head .game-title {
    margin-bottom: 4px;
}

.game-thumb {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: var(--surface-light);
}

.bgg-link {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-decoration: none;
}

.bgg-link:hover {
    color: var(--secondary);
}

.bgg-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.bgg-facts span {
    background: rgba(236, 72, 153, 0.12);
    color: var(--text);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.82rem;
}

.bgg-notice {
    background: rgba(245, 158, 11, 0.12);
    border-left: 4px solid var(--warning);
    color: #FCD34D;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.app-footer {
    text-align: center;
    padding: 40px 0 10px;
}

.powered-bgg {
    display: inline-block;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.powered-bgg:hover {
    opacity: 1;
}

.powered-bgg img {
    display: block;
    width: 160px;
    height: auto;
}
