/* css/style.css */
/* Main Stylesheet - Travian Clone */

:root {
    --primary: #8b5a2b;
    --primary-dark: #6b4423;
    --secondary: #2d5a27;
    --gold: #ffd700;
    --wood: #8b4513;
    --clay: #cd853f;
    --iron: #708090;
    --crop: #9acd32;
    --bg-dark: #1a1a2e;
    --bg-medium: #16213e;
    --bg-light: #0f3460;
    --text-light: #e8e8e8;
    --text-muted: #a0a0a0;
    --danger: #dc3545;
    --success: #28a745;
    --warning: #ffc107;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
    color: var(--text-light);
    min-height: 100vh;
    line-height: 1.6;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px var(--gold); }
    50% { box-shadow: 0 0 20px var(--gold); }
}

@keyframes building {
    0% { transform: scaleY(0.8); }
    50% { transform: scaleY(1.02); }
    100% { transform: scaleY(1); }
}

.animate-fade { animation: fadeIn 0.5s ease-out; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-slide { animation: slideIn 0.3s ease-out; }
.animate-bounce { animation: bounce 1s infinite; }
.animate-glow { animation: glow 2s infinite; }

/* Header */
.header {
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--gold);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    text-decoration: none;
}

/* Resource Bar */
.resource-bar {
    display: flex;
    gap: 15px;
    background: rgba(0,0,0,0.3);
    padding: 8px 15px;
    border-radius: 25px;
    flex-wrap: wrap;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.resource-item:hover {
    transform: scale(1.1);
}

.resource-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.resource-wood { background: var(--wood); }
.resource-clay { background: var(--clay); }
.resource-iron { background: var(--iron); }
.resource-crop { background: var(--crop); }
.resource-gold { background: var(--gold); color: #333; }

.resource-value {
    font-weight: bold;
}

.resource-rate {
    font-size: 0.75rem;
    color: var(--success);
}

/* Navigation */
.nav {
    background: var(--bg-light);
    padding: 10px 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--primary);
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-link:hover, .nav-link.active {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(139, 90, 43, 0.4);
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Cards */
.card {
    background: linear-gradient(145deg, var(--bg-light), var(--bg-medium));
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    animation: fadeIn 0.5s ease-out;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.card-title {
    font-size: 1.3rem;
    color: var(--gold);
}

/* Village View */
.village-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.building-slot {
    aspect-ratio: 1;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.building-slot:hover {
    transform: scale(1.05);
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.building-slot.empty {
    background: repeating-linear-gradient(
        45deg,
        rgba(0,0,0,0.2),
        rgba(0,0,0,0.2) 10px,
        rgba(0,0,0,0.3) 10px,
        rgba(0,0,0,0.3) 20px
    );
}

.building-slot.upgrading {
    animation: pulse 1.5s infinite;
    border-color: var(--warning);
}

.building-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.building-name {
    font-size: 0.75rem;
    text-align: center;
    color: var(--text-muted);
}

.building-level {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--primary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}

.building-timer {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    color: var(--warning);
}

/* Resource Fields */
.resource-fields {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 20px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect fill="%232d5a27" width="100" height="100"/></svg>');
    background-size: cover;
    border-radius: 15px;
    position: relative;
}

.resource-field {
    aspect-ratio: 1;
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.resource-field:hover {
    transform: scale(1.1);
    z-index: 10;
}

.resource-field.wood { border-color: var(--wood); background: rgba(139, 69, 19, 0.5); }
.resource-field.clay { border-color: var(--clay); background: rgba(205, 133, 63, 0.5); }
.resource-field.iron { border-color: var(--iron); background: rgba(112, 128, 144, 0.5); }
.resource-field.crop { border-color: var(--crop); background: rgba(154, 205, 50, 0.5); }

/* Map */
.map-container {
    overflow: hidden;
    border-radius: 15px;
    background: #1a3d1a;
    position: relative;
    height: 500px;
    touch-action: none;
}

.map-grid {
    display: grid;
    grid-template-columns: repeat(21, 40px);
    gap: 1px;
    padding: 10px;
    cursor: grab;
}

.map-tile {
    width: 40px;
    height: 40px;
    background: #2d5a27;
    border: 1px solid rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    cursor: pointer;
    transition: all 0.2s;
}

.map-tile:hover {
    transform: scale(1.2);
    z-index: 10;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.map-tile.village {
    background: var(--primary);
    border-radius: 5px;
}

.map-tile.own-village {
    background: var(--success);
    animation: pulse 2s infinite;
}

.map-tile.oasis {
    background: #4a7c4a;
}

.map-tile.npc-village {
    background: linear-gradient(135deg, #4a1c1c 0%, #6b2d2d 100%);
    border: 2px solid #f87171;
    border-radius: 5px;
    animation: npcGlow 3s infinite;
}

.map-tile.npc-village:hover {
    transform: scale(1.3);
    z-index: 10;
    box-shadow: 0 0 15px rgba(248, 113, 113, 0.7);
}

@keyframes npcGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(248, 113, 113, 0.3); }
    50% { box-shadow: 0 0 10px rgba(248, 113, 113, 0.5); }
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 90, 43, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 90, 43, 0.6);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #1e7e34 100%);
    color: white;
}

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

.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, #b8860b 100%);
    color: #333;
    animation: glow 2s infinite;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--bg-light);
    border-radius: 10px;
    background: rgba(0,0,0,0.3);
    color: var(--text-light);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(139, 90, 43, 0.3);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.table th {
    background: rgba(0,0,0,0.3);
    color: var(--gold);
}

.table tr:hover {
    background: rgba(255,255,255,0.05);
}

/* Troops */
.troop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.troop-card {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.troop-card:hover {
    border-color: var(--gold);
    transform: translateY(-5px);
}

.troop-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.troop-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.troop-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-medium);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.8);
    transition: transform 0.3s;
    border: 2px solid var(--primary);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Progress Bar */
.progress {
    height: 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--gold));
    border-radius: 10px;
    transition: width 0.5s;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Notifications */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    z-index: 3000;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.notification.success { background: var(--success); }
.notification.error { background: var(--danger); }
.notification.warning { background: var(--warning); color: #333; }

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: linear-gradient(145deg, var(--bg-light), var(--bg-medium));
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 2px solid var(--primary);
}

.auth-title {
    text-align: center;
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 30px;
}

/* Tribe Selection */
.tribe-select {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.tribe-option {
    text-align: center;
    padding: 20px 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.tribe-option:hover, .tribe-option.selected {
    border-color: var(--gold);
    transform: scale(1.05);
}

.tribe-option.selected {
    background: rgba(139, 90, 43, 0.3);
}

.tribe-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.tribe-name {
    font-weight: bold;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
    }

    .resource-bar {
        width: 100%;
        justify-content: center;
    }

    .nav {
        padding: 10px;
    }

    .village-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .resource-fields {
        grid-template-columns: repeat(4, 1fr);
    }

    .container {
        padding: 10px;
    }

    .tribe-select {
        grid-template-columns: 1fr;
    }

    .map-container {
        height: 350px;
    }
}

/* Loading Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 100;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Village Dropdown */
.village-dropdown a {
    transition: all 0.2s;
}

.village-dropdown a:hover {
    background: rgba(255, 215, 0, 0.2);
}

.village-switcher button {
    cursor: pointer;
}

.village-switcher button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
