/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --color-primary: #1a9e7e;
    --color-primary-dark: #157a61;
    --color-secondary: #2a3f5f;
    --color-accent: #ff6b35;
    --color-bg-dark: #0a0e1a;
    --color-bg-overlay: rgba(10, 14, 26, 0.92);
    --color-text-light: #e8f0f2;
    --color-text-muted: #a0aec0;
    --color-border: rgba(255, 255, 255, 0.1);
    --color-glass: rgba(255, 255, 255, 0.05);

    /* Typography */
    --font-primary: 'Orbitron', sans-serif;
    --font-secondary: 'Rajdhani', sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Effects */
    --shadow-glow: 0 0 20px rgba(26, 158, 126, 0.3);
    --shadow-deep: 0 10px 40px rgba(0, 0, 0, 0.6);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Announcement Bar */
.announcement-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(90deg, #ff0000, #990000);
    color: white;
    z-index: 9999;
    overflow: hidden;
    line-height: 30px;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    display: flex;
    align-items: center;
}

.announcement-bar.hidden {
    display: none;
}

.marquee-content {
    display: inline-block;
    white-space: nowrap;
    animation: marquee 15s linear infinite;
    padding-left: 100%;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

body {
    font-family: var(--font-secondary);
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    min-height: 100vh;
    background-image: url('../assets/war-background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    overflow-x: hidden;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
            rgba(10, 14, 26, 0.95) 0%,
            rgba(42, 63, 95, 0.85) 50%,
            rgba(10, 14, 26, 0.95) 100%);
    z-index: -1;
}

/* Header Styles */
.main-header {
    text-align: center;
    padding: var(--spacing-lg) 0;
    position: relative;
}

.logo-container {
    display: inline-block;
    position: relative;
}

.game-logo {
    font-family: var(--font-primary);
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-text {
    font-size: 4rem;
    background: linear-gradient(135deg, #fff 0%, #1a9e7e 50%, #fff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(26, 158, 126, 0.5);
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.8));
    animation: logoGlow 3s ease-in-out infinite;
}

.logo-subtitle {
    font-size: 2.5rem;
    margin-top: -0.5rem;
    letter-spacing: 0.5em;
}

@keyframes logoGlow {

    0%,
    100% {
        filter: drop-shadow(0 5px 15px rgba(26, 158, 126, 0.5));
    }

    50% {
        filter: drop-shadow(0 5px 25px rgba(26, 158, 126, 0.8));
    }
}

.tagline {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-top: var(--spacing-sm);
    letter-spacing: 0.2em;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: var(--spacing-lg);
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg) var(--spacing-xl);
}

/* Section Styles */
section {
    background: var(--color-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-deep);
    transition: var(--transition-smooth);
}

section:hover {
    border-color: rgba(26, 158, 126, 0.3);
    box-shadow: var(--shadow-glow), var(--shadow-deep);
}

.section-title {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--spacing-md);
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    position: relative;
    padding-bottom: var(--spacing-sm);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
}

/* Alert Banner */
.alert-banner {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 107, 53, 0.1));
    border: 1px solid rgba(255, 107, 53, 0.4);
    border-radius: 8px;
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    text-align: center;
    font-size: 0.85rem;
    color: #ffb399;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* Auth Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.auth-form.hidden {
    display: none;
}

.form-title {
    font-family: var(--font-primary);
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: var(--spacing-md);
    color: var(--color-primary);
}

.form-group {
    position: relative;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-light);
    font-family: var(--font-secondary);
    font-size: 1rem;
    transition: var(--transition-smooth);
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(26, 158, 126, 0.2);
}

.form-group input::placeholder {
    color: var(--color-text-muted);
}

.password-group {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: var(--spacing-sm);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.6;
    transition: var(--transition-smooth);
}

.toggle-password:hover {
    opacity: 1;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: 8px;
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(26, 158, 126, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(26, 158, 126, 0.6);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--color-secondary), #1a2a3f);
    color: white;
    box-shadow: 0 4px 15px rgba(42, 63, 95, 0.4);
}

.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(42, 63, 95, 0.6);
    transform: translateY(-2px);
}

.form-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: var(--spacing-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.form-footer:hover {
    color: var(--color-primary);
}

/* Game Info Section */
.info-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--color-text-light);
}

.info-content p {
    margin-bottom: var(--spacing-md);
}

.info-list {
    list-style: none;
    padding-left: 0;
}

.info-list li {
    padding: var(--spacing-xs) 0;
    padding-left: var(--spacing-lg);
    position: relative;
}

.info-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-size: 1.2rem;
}

/* Rankings Section */
.rankings-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.tab-btn {
    flex: 1;
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-muted);
    font-family: var(--font-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-light);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-color: var(--color-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(26, 158, 126, 0.3);
}

.rankings-content {
    display: block;
}

.rankings-content.hidden {
    display: none;
}

.ranking-list {
    list-style: none;
    padding: 0;
}

.ranking-list li {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.ranking-list li:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--color-primary);
    transform: translateX(5px);
}

.ranking-list .rank {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--color-primary);
    min-width: 40px;
}

.ranking-list .name {
    flex: 1;
    font-weight: 600;
    color: var(--color-text-light);
}

.ranking-list .score {
    font-family: var(--font-primary);
    font-size: 0.9rem;
    color: var(--color-accent);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .logo-text {
        font-size: 3rem;
    }

    .logo-subtitle {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .logo-text {
        font-size: 2.5rem;
    }

    .logo-subtitle {
        font-size: 1.5rem;
    }

    section {
        padding: var(--spacing-md);
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: var(--spacing-md);
    background: var(--color-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-deep);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    border-color: var(--color-primary);
}

.notification.error {
    border-color: var(--color-accent);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
    pointer-events: none;
    opacity: 0;
}

.modal-content {
    background: rgba(10, 14, 26, 0.95);
    border: 1px solid var(--color-primary);
    border-radius: 12px;
    padding: var(--spacing-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 30px rgba(26, 158, 126, 0.3);
    position: relative;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--spacing-sm);
}

.modal-header h2 {
    color: var(--color-primary);
    font-family: var(--font-primary);
    margin: 0;
}

.close-modal-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.close-modal-btn:hover {
    color: var(--color-accent);
}

.profile-info-grid {
    display: grid;
    gap: var(--spacing-md);
}

.profile-group label {
    display: block;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.profile-group .value {
    font-size: 1.1rem;
    color: white;
    font-weight: bold;
    font-family: var(--font-primary);
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.modal-footer {
    margin-top: var(--spacing-lg);
    text-align: right;
}
/* --- RESPONSIVE DESIGN --- */

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr; /* Stack everything on tablets/small laptops */
        padding: 0 var(--spacing-sm) var(--spacing-lg);
    }
}

@media (max-width: 768px) {
    /* Global Adjustments */
    :root {
        --spacing-lg: 1rem;
        --spacing-xl: 2rem;
    }

    body {
        font-size: 14px;
        background-attachment: scroll; /* Performance on mobile */
    }

    /* Stack main layout */
    .main-content {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-md);
        padding: 5px;
        width: 100%;
        max-width: 100%;
    }

    /* Header adjustments */
    .main-header {
        padding: var(--spacing-sm) 0;
    }

    .game-logo .logo-text {
        font-size: 2.5rem;
    }

    .game-logo .logo-subtitle {
        font-size: 1rem;
    }

    /* Navigation Menu */
    .menu-bar {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 5px;
        margin-bottom: 20px;
    }

    .menu-btn {
        flex: 1 1 45%; /* Buttons take up half width roughly */
        font-size: 0.9rem;
        padding: 10px 5px;
        text-align: center;
        margin-bottom: 5px;
    }

    /* Resource Bar - Compact Grid */
    .resource-bar {
        display: grid;
        grid-template-columns: repeat(3, 1fr); /* 3 items per row */
        gap: 8px;
        font-size: 0.8rem;
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .resource-item {
        flex-direction: column;
        text-align: center;
        padding: 5px;
    }

    .resource-item span {
        font-size: 0.8rem;
    }

    /* Map Handling */
    .svg-map-container {
        height: 50vh; 
        min-height: 250px;
    }

    /* Panels (Buildings, Army, etc.) */
    .building-item, .army-item {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
        gap: 10px;
        background: rgba(255, 255, 255, 0.03);
    }

    .building-info, .army-info {
        width: 100%;
    }

    .build-btn, .train-btn {
        width: 100%;
        padding: 12px;
        margin-top: 5px;
    }
    
    .input-group {
        width: 100%;
    }
    
    .input-group input {
        width: 100%;
        margin-bottom: 5px;
    }

    /* Modals & Overlays */
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
        overflow-y: auto;
        padding: 15px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    /* Alliance & Messages */
    .alliance-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .alliance-item button {
        width: 100%;
    }
}
