/* ==========================================================================
   NEON SPACE INVADERS - GLOBAL CSS DESIGN SYSTEM
   ========================================================================== */

:root {
    --bg-dark: #05050a;
    --card-bg: rgba(10, 10, 22, 0.65);
    --border-color: rgba(0, 242, 254, 0.15);
    
    /* Neon Colors */
    --neon-cyan: #00f2fe;
    --neon-magenta: #fe019a;
    --neon-green: #39ff14;
    --neon-yellow: #f5d300;
    --neon-red: #ff073a;
    --neon-blue: #005bfa;

    /* Glows */
    --glow-cyan: 0 0 10px rgba(0, 242, 254, 0.6), 0 0 20px rgba(0, 242, 254, 0.2);
    --glow-magenta: 0 0 10px rgba(fe, 01, 9a, 0.6), 0 0 20px rgba(fe, 01, 9a, 0.2);
    --glow-green: 0 0 10px rgba(57, 255, 20, 0.6), 0 0 20px rgba(57, 255, 20, 0.2);
    --glow-yellow: 0 0 10px rgba(245, 211, 0, 0.6), 0 0 20px rgba(245, 211, 0, 0.2);
    --glow-red: 0 0 10px rgba(255, 7, 58, 0.6), 0 0 20px rgba(255, 7, 58, 0.2);
    --glow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.7), 0 0 15px rgba(0, 242, 254, 0.08);

    /* Fonts */
    --font-sci-fi: 'Orbitron', 'Rajdhani', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

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

body, html {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    font-family: var(--font-sci-fi);
    color: #e0e0f0;
    overflow: hidden;
    position: relative;
}

/* ==========================================================================
   CSS ZVJEZDANA POZADINA (STARFIELD PARALLAX)
   ========================================================================== */

.stars, .twinkling {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.stars {
    background: #000 url('https://i.imgur.com/Y1Z2ywR.png') repeat top center;
    z-index: -3;
}

.twinkling {
    background: transparent url('https://i.imgur.com/S2nd9R7.png') repeat top center;
    z-index: -2;
    animation: move-twink-back 200s linear infinite;
}

@keyframes move-twink-back {
    from { background-position: 0 0; }
    to { background-position: -10000px 5000px; }
}

/* ==========================================================================
   LAYOUT & SCREENS
   ========================================================================== */

#app-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 1;
    position: relative;
}

.screen {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: scale(0.95);
    width: 100%;
    max-width: 900px;
    justify-content: center;
    align-items: center;
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

/* Specijalne klase za neonske boje */
.neon-cyan { color: var(--neon-cyan); text-shadow: var(--glow-cyan); }
.neon-magenta { color: var(--neon-magenta); text-shadow: var(--glow-magenta); }
.neon-green { color: var(--neon-green); text-shadow: var(--glow-green); }
.neon-yellow { color: var(--neon-yellow); text-shadow: var(--glow-yellow); }
.neon-red { color: var(--neon-red); text-shadow: var(--glow-red); }

.neon-cyan-text { color: var(--neon-cyan); }
.neon-magenta-text { color: var(--neon-magenta); }
.neon-green-text { color: var(--neon-green); }
.neon-yellow-text { color: var(--neon-yellow); }
.neon-red-text { color: var(--neon-red); }

/* ==========================================================================
   GLASSMORPHISM CARD STYLE
   ========================================================================== */

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--glow-card);
    width: 100%;
    max-width: 500px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.glass-card.wide-card {
    max-width: 850px;
}

.neon-title {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 4px;
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.8), 0 0 20px rgba(0, 242, 254, 0.4), 0 0 30px rgba(0, 242, 254, 0.2);
    z-index: 1;
    position: relative;
}

.subtitle {
    font-family: var(--font-mono);
    color: #a0a0c0;
    font-size: 0.95rem;
    margin-bottom: 30px;
    z-index: 1;
    position: relative;
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */

.tab-buttons {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    padding: 4px;
    margin-bottom: 25px;
    z-index: 1;
    position: relative;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 10px 15px;
    color: #a0a0c0;
    font-family: var(--font-sci-fi);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: linear-gradient(90deg, #005bfa, #00f2fe);
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

.input-group {
    text-align: left;
    margin-bottom: 20px;
    z-index: 1;
    position: relative;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
    color: var(--neon-cyan);
    text-transform: uppercase;
}

.input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    outline: none;
    padding: 12px 18px;
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.3), inset 0 0 5px rgba(0, 242, 254, 0.2);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.neon-btn {
    width: 100%;
    background: transparent;
    color: #fff;
    font-family: var(--font-sci-fi);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 2px;
    padding: 14px 28px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

/* Cyan Button */
.primary-btn {
    border: 2px solid var(--neon-cyan);
    box-shadow: inset 0 0 6px rgba(0, 242, 254, 0.2);
}
.primary-btn:hover {
    background: var(--neon-cyan);
    color: #000;
    box-shadow: var(--glow-cyan);
    transform: translateY(-2px);
}

/* Green Button */
.success-btn {
    border: 2px solid var(--neon-green);
    box-shadow: inset 0 0 6px rgba(57, 255, 20, 0.2);
}
.success-btn:hover {
    background: var(--neon-green);
    color: #000;
    box-shadow: var(--glow-green);
    transform: translateY(-2px);
}

/* Magenta Button */
.danger-btn {
    border: 2px solid var(--neon-magenta);
    box-shadow: inset 0 0 6px rgba(254, 1, 154, 0.2);
}
.danger-btn:hover {
    background: var(--neon-magenta);
    color: #fff;
    box-shadow: var(--glow-magenta);
    transform: translateY(-2px);
}

/* Yellow Button */
.info-btn {
    border: 2px solid var(--neon-yellow);
    box-shadow: inset 0 0 6px rgba(245, 211, 0, 0.2);
}
.info-btn:hover {
    background: var(--neon-yellow);
    color: #000;
    box-shadow: var(--glow-yellow);
    transform: translateY(-2px);
}

.text-link-btn {
    background: transparent;
    border: none;
    color: #a0a0c0;
    font-family: var(--font-mono);
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.text-link-btn:hover {
    color: var(--neon-cyan);
    text-shadow: 0 0 5px rgba(0, 242, 254, 0.5);
}

.guest-action {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: #606080;
    z-index: 1;
    position: relative;
}

.or-text {
    font-family: var(--font-mono);
}

/* Messages */
.message-box {
    margin: 15px 0 0 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    min-height: 20px;
    transition: all 0.3s ease;
}

.message-box.error { color: var(--neon-red); text-shadow: var(--glow-red); }
.message-box.success { color: var(--neon-green); text-shadow: var(--glow-green); }

/* ==========================================================================
   GLAVNI IZBORNIK & PROFIL BADGE
   ========================================================================== */

.user-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    margin-bottom: 25px;
    z-index: 1;
    position: relative;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 25px;
}

.controls-panel {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 25px;
    text-align: left;
    z-index: 1;
    position: relative;
}

.controls-panel h3 {
    font-size: 0.9rem;
    color: #fff;
    letter-spacing: 1px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.key-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: #b0b0d0;
}

.key {
    display: inline-block;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 8px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 0 rgba(255, 255, 255, 0.2);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1;
    position: relative;
}

.settings-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #b0b0d0;
    letter-spacing: 1px;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.5);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* ==========================================================================
   GAME HUD & CANVAS
   ========================================================================== */

#game-screen {
    flex-direction: column;
    gap: 15px;
    max-width: 820px;
}

.game-hud {
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--glow-card);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hud-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #8080a0;
}

.hud-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
}

.heart {
    color: var(--neon-red);
    text-shadow: var(--glow-red);
    font-size: 1.2rem;
    margin: 0 2px;
}

.hud-controls {
    display: flex;
    align-items: center;
}

.hud-btn {
    background: transparent;
    border: 1px solid var(--neon-cyan);
    border-radius: 6px;
    color: var(--neon-cyan);
    font-family: var(--font-sci-fi);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hud-btn:hover {
    background: var(--neon-cyan);
    color: #000;
    box-shadow: var(--glow-cyan);
}

.canvas-container {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 242, 254, 0.05);
    background-color: #000;
}

#gameCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.canvas-overlay.active {
    display: flex;
}

.overlay-content {
    text-align: center;
    max-width: 400px;
    padding: 20px;
}

.overlay-content h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    letter-spacing: 2px;
    text-shadow: var(--glow-cyan);
}

.overlay-content p {
    font-family: var(--font-mono);
    color: #a0a0c0;
    margin-bottom: 25px;
    font-size: 0.9rem;
}

/* ==========================================================================
   MEĐUEKRAN & LEADERBOARDS
   ========================================================================== */

.intermission-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
    margin-bottom: 30px;
    text-align: left;
}

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

.game-stats-box, .leaderboard-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
}

.game-stats-box h3, .leaderboard-box h3 {
    font-size: 0.95rem;
    letter-spacing: 1px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 1rem;
    margin-bottom: 15px;
    color: #b0b0d0;
}

.stat-row span:last-child {
    font-weight: 700;
}

/* Tables style */
.table-wrapper {
    max-height: 250px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0, 242, 254, 0.3);
    text-transform: uppercase;
}

td {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #c0c0e0;
}

tr.current-user-row {
    background: rgba(0, 242, 254, 0.1);
    box-shadow: inset 0 0 5px rgba(0, 242, 254, 0.2);
}

tr.current-user-row td {
    color: #fff;
    font-weight: 700;
}

/* Custom scrollbar */
.table-wrapper::-webkit-scrollbar {
    width: 6px;
}
.table-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
.table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0, 242, 254, 0.3);
    border-radius: 3px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--neon-cyan);
}

.intermission-actions {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.intermission-actions .neon-btn {
    max-width: 300px;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes pulse-cyan {
    0% { text-shadow: 0 0 10px rgba(0, 242, 254, 0.7), 0 0 20px rgba(0, 242, 254, 0.3); }
    50% { text-shadow: 0 0 15px rgba(0, 242, 254, 0.9), 0 0 30px rgba(0, 242, 254, 0.6), 0 0 40px rgba(0, 242, 254, 0.3); }
    100% { text-shadow: 0 0 10px rgba(0, 242, 254, 0.7), 0 0 20px rgba(0, 242, 254, 0.3); }
}

@keyframes pulse-green {
    0% { text-shadow: 0 0 10px rgba(57, 255, 20, 0.7); }
    50% { text-shadow: 0 0 15px rgba(57, 255, 20, 0.9), 0 0 25px rgba(57, 255, 20, 0.5); }
    100% { text-shadow: 0 0 10px rgba(57, 255, 20, 0.7); }
}

@keyframes pulse-red {
    0% { text-shadow: 0 0 10px rgba(255, 7, 58, 0.7); }
    50% { text-shadow: 0 0 15px rgba(255, 7, 58, 0.9), 0 0 25px rgba(255, 7, 58, 0.5); }
    100% { text-shadow: 0 0 10px rgba(255, 7, 58, 0.7); }
}

@keyframes pulse-info {
    0% { text-shadow: 0 0 10px rgba(245, 211, 0, 0.7); }
    50% { text-shadow: 0 0 15px rgba(245, 211, 0, 0.9), 0 0 25px rgba(245, 211, 0, 0.5); }
    100% { text-shadow: 0 0 10px rgba(245, 211, 0, 0.7); }
}

.text-pulse {
    animation: pulse-cyan 3s infinite;
}

.green-pulse {
    animation: pulse-green 3s infinite;
    color: var(--neon-green);
}

.red-pulse {
    animation: pulse-red 2s infinite;
    color: var(--neon-red);
}

.info-pulse {
    animation: pulse-info 3s infinite;
    color: var(--neon-yellow);
}

/* ==========================================================================
   PROFIL I STATISTIKA (PROFILE & STATISTICS GLASSMORPHISM)
   ========================================================================== */

.profile-card {
    max-width: 800px;
}

.profile-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-top: 20px;
    text-align: left;
}

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

.profile-info-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    box-shadow: inset 0 0 15px rgba(0, 242, 254, 0.05);
}

.avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    font-size: 3.5rem;
    filter: drop-shadow(0 0 10px var(--neon-cyan));
    animation: float-avatar 3s ease-in-out infinite;
}

@keyframes float-avatar {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(3deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

.profile-high-score {
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    padding-top: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.stat-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 18px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 242, 254, 0.25);
    box-shadow: 0 4px 20px rgba(0, 242, 254, 0.1);
    background: rgba(0, 242, 254, 0.03);
}

.stat-icon {
    font-size: 1.8rem;
    margin-bottom: 2px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.75rem;
    color: #8080a0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    text-align: center;
}
