/**
 * Aethelgard — MAIN STYLES
 * ===================
 * CSS custom per il tema dark fantasy.
 * Complementa Tailwind con classi specifiche del gioco.
 */

/* ============================================
   MODAL INPUTS & BUTTONS
   ============================================ */
.input-gold {
    width: 100%;
    background: #1a1a2e;
    border: 1px solid #2a2a45;
    border-radius: 8px;
    padding: 12px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.input-gold:focus { border-color: var(--aethelgard-gold); }
.input-gold::placeholder { color: #6b7280; }

.btn-gold-gradient {
    width: 100%;
    background: linear-gradient(135deg, var(--aethelgard-gold), #b8942f);
    color: #0a0e17;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-gold-gradient:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-gold-gradient:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #6b7280;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close:hover { color: var(--aethelgard-gold); }

/* ============================================
   THEME VARIABLES
   ============================================ */
:root {
    --aethelgard-bg: #0a0e17;
    --aethelgard-bg-light: #111827;
    --aethelgard-bg-card: #1a1f2e;
    --aethelgard-border: #d4a853;
    --aethelgard-border-sub: #374151;
    --aethelgard-gold: #d4a853;
    --aethelgard-gold-light: #f0d78c;
    --aethelgard-text: #e5e7eb;
    --aethelgard-text-muted: #9ca3af;
    --aethelgard-text-dark: #6b7280;
}

/* ============================================
   LAYOUT
   ============================================ */
#scene-game {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--aethelgard-bg);
}

/* ============================================
   SIDEBAR
   ============================================ */
.aethelgard-sidebar {
    width: 260px;
    background: var(--aethelgard-bg-light);
    border-right: 1px solid rgba(212,168,83,0.1);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--aethelgard-text-dark);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 16px 16px 8px;
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 2px 8px;
    border-radius: 8px;
    color: var(--aethelgard-text-muted);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: var(--aethelgard-text);
}

.nav-link-active {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 2px 8px;
    border-radius: 8px;
    background: rgba(212,168,83,0.1);
    color: var(--aethelgard-gold);
    font-size: 14px;
    text-decoration: none;
    font-weight: 500;
}

.nav-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-label { white-space: nowrap; }

/* Mobile sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 40;
}

.sidebar-overlay.active { display: block; }

@media (max-width: 1023px) {
    .aethelgard-sidebar {
        position: fixed;
        inset-y: 0;
        left: 0;
        z-index: 50;
        transform: translateX(-100%);
    }
    .aethelgard-sidebar.open { transform: translateX(0); }
}

/* ============================================
   TOPBAR
   ============================================ */
.aethelgard-topbar {
    background: var(--aethelgard-bg-light);
    border-bottom: 1px solid rgba(212,168,83,0.1);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============================================
   CARDS
   ============================================ */
.dash-card {
    background: var(--aethelgard-bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.dash-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--aethelgard-gold);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-stat-card {
    background: var(--aethelgard-bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 16px;
}

/* ============================================
   DASHBOARD SPECIFIC
   ============================================ */
.dash-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.dash-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    background: linear-gradient(135deg, rgba(212,168,83,0.2), rgba(168,85,247,0.1));
    border: 2px solid rgba(212,168,83,0.3);
    color: var(--aethelgard-gold);
}

.dash-name {
    color: white;
    font-size: 20px;
    font-weight: bold;
}

.dash-meta {
    color: var(--aethelgard-text-muted);
    font-size: 13px;
    margin-top: 2px;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

@media (min-width: 768px) {
    .dash-grid { grid-template-columns: repeat(4, 1fr); }
}

.dash-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.dash-action-btn {
    padding: 10px;
    background: rgba(212,168,83,0.08);
    border: 1px solid rgba(212,168,83,0.15);
    border-radius: 8px;
    color: var(--aethelgard-gold);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.dash-action-btn:hover {
    background: rgba(212,168,83,0.15);
}

/* ============================================
   PROGRESS BARS
   ============================================ */
.progress-bar-bg {
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    overflow: hidden;
    height: 6px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 640px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

.stat-item {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 10px;
}

/* ============================================
   INPUTS & BUTTONS
   ============================================ */
.input-dark {
    background: #1a1f2e;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.input-dark:focus {
    border-color: var(--aethelgard-gold);
}

.input-dark::placeholder {
    color: #6b7280;
}

.btn-gold {
    background: linear-gradient(135deg, var(--aethelgard-gold), #b8942f);
    color: #0a0e17;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-gold:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-success {
    background: rgba(16,185,129,0.2);
    border: 1px solid rgba(16,185,129,0.3);
    color: #34d399;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-success:hover {
    background: rgba(16,185,129,0.3);
}

.btn-danger {
    background: rgba(239,68,68,0.2);
    border: 1px solid rgba(239,68,68,0.3);
    color: #f87171;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: rgba(239,68,68,0.3);
}

/* ============================================
   CHAT
   ============================================ */
.chat-header {
    background: var(--aethelgard-bg-light);
    border-bottom: 1px solid rgba(212,168,83,0.1);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--aethelgard-gold);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-bubble {
    background: var(--aethelgard-bg-light);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 8px 12px;
    max-width: 85%;
}

.chat-bubble-own {
    background: rgba(212,168,83,0.08);
    border: 1px solid rgba(212,168,83,0.15);
    border-radius: 12px;
    padding: 8px 12px;
    max-width: 85%;
    margin-left: auto;
}

.chat-name {
    font-size: 11px;
    color: var(--aethelgard-gold);
    font-weight: 600;
}

.chat-name-own {
    font-size: 11px;
    color: var(--aethelgard-text-muted);
    font-weight: 600;
}

.chat-input-area {
    background: var(--aethelgard-bg-light);
    border-top: 1px solid rgba(212,168,83,0.1);
    padding: 12px;
}

/* ============================================
   MAP
   ============================================ */
.map-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 640px) {
    .map-grid { grid-template-columns: repeat(3, 1fr); }
}

.map-card {
    background: var(--aethelgard-bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.map-card:hover {
    border-color: rgba(212,168,83,0.3);
    transform: translateY(-2px);
}

.map-card-active {
    border-color: var(--aethelgard-gold);
    background: rgba(212,168,83,0.05);
}

/* ============================================
   LANDING
   ============================================ */
#scene-landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    position: relative;
    z-index: 10;
}

.landing-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    color: var(--aethelgard-gold);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.landing-subtitle {
    font-family: 'Cinzel', serif;
    font-size: clamp(0.75rem, 2vw, 1rem);
    color: rgba(212,168,83,0.6);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 40px;
}

.landing-btn {
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.landing-btn-primary {
    background: linear-gradient(135deg, var(--aethelgard-gold), #b8942f);
    color: #0a0e17;
}

.landing-btn-primary:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
}

.landing-btn-secondary {
    background: transparent;
    border: 1px solid rgba(212,168,83,0.4);
    color: var(--aethelgard-gold);
}

.landing-btn-secondary:hover {
    background: rgba(212,168,83,0.1);
    border-color: var(--aethelgard-gold);
}

/* ============================================
   LOADER
   ============================================ */
#app-loader {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--aethelgard-bg);
}

.loader-crystal {
    font-size: 3rem;
    color: var(--aethelgard-gold);
    animation: pulse 2s ease-in-out infinite;
}

.loader-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--aethelgard-gold);
    letter-spacing: 0.15em;
    margin-bottom: 24px;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--aethelgard-bg-card);
    border: 1px solid rgba(212,168,83,0.2);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--aethelgard-text-muted);
    font-size: 24px;
    cursor: pointer;
}

/* ============================================
   UTILITY
   ============================================ */
.page-title {
    font-family: 'Cinzel', serif;
    font-size: 1.25rem;
    color: var(--aethelgard-gold);
    margin-bottom: 16px;
}

.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4b5563; }

/* Selection */
::selection {
    background: rgba(212,168,83,0.3);
    color: white;
}
