/* ==========================================
   Kabile Savaslari - Tribal Wars Clone CSS
   Medieval theme with brown/beige tones
   ========================================== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    color: #3e2b1a;
    background: #f5e6c8 url('https://www.transparenttextures.com/patterns/papyros.png');
    min-height: 100vh;
    padding-bottom: 60px;
    /* Space for fixed footer */
}

a {
    color: #5c3d1a;
    text-decoration: none;
}

a:hover {
    color: #8b5a2b;
    text-decoration: underline;
}

/* ==========================================
   Login Page
   ========================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #3e2b1a 0%, #6b4423 50%, #3e2b1a 100%);
}

.login-container {
    background: #fdf5e6;
    border: 3px solid #8b6914;
    border-radius: 8px;
    padding: 40px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 320px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 8px auto;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.login-header h1 {
    color: #5c3d1a;
    font-size: 28px;
    margin-bottom: 8px;
}

.login-header p {
    color: #8b6914;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #5c3d1a;
}

.login-form input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #c4a265;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    color: #3e2b1a;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: #8b6914;
    box-shadow: 0 0 5px rgba(139, 105, 20, 0.3);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: #8b6914;
}

.login-footer a {
    color: #5c3d1a;
    font-weight: 600;
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border: 2px solid #8b6914;
    border-radius: 4px;
    background: linear-gradient(to bottom, #f0d78c, #d4a843);
    color: #3e2b1a;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn:hover {
    background: linear-gradient(to bottom, #f7e5a0, #e0b84e);
    text-decoration: none;
    color: #3e2b1a;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(to bottom, #6b8e23, #4a6b15);
    color: #fff;
    border-color: #3d5a0f;
}

.btn-primary:hover {
    background: linear-gradient(to bottom, #7ba428, #5a7e1a);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(to bottom, #c0392b, #96281b);
    color: #fff;
    border-color: #7b1f15;
}

.btn-danger:hover {
    background: linear-gradient(to bottom, #d44637, #a83020);
    color: #fff;
}

.btn-small {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

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

/* ==========================================
   Alerts
   ========================================== */
.alert {
    padding: 10px 16px;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 1px solid;
}

.alert-error {
    background: #fce4e4;
    border-color: #c0392b;
    color: #96281b;
}

.alert-success {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.alert-info {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}

.alert-warning {
    background: #fff3e0;
    border-color: #ff9800;
    color: #e65100;
}

/* ==========================================
   Top Bar
   ========================================== */
.top-bar {
    background: linear-gradient(to bottom, #5c3d1a, #3e2b1a);
    color: #f0d78c;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #8b6914;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-bar a {
    color: #f0d78c;
}

.top-bar a:hover {
    color: #fff;
    text-decoration: none;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-logo {
    height: 36px;
    width: auto;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s;
}

.logo-text {
    font-family: 'Georgia', serif;
    font-size: 22px;
    background: linear-gradient(to bottom, #f0d78c 0%, #d4a843 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.8));
    display: flex;
    align-items: center;
}

.header-logo:hover {
    filter: brightness(1.3);
}

.footer-logo {
    height: 24px;
    width: auto;
    opacity: 0.7;
    filter: grayscale(30%);
}

.login-logo {
    width: 180px;
    height: auto;
    margin: 0 auto 15px;
    display: block;
}

.top-bar-center {
    display: flex;
    gap: 20px;
}

.top-link {
    font-size: 15px;
    font-weight: 600;
}

.badge {
    background: #c0392b;
    color: #fff;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 3px;
}

/* ==========================================
   Resource Bar
   ========================================== */
.resource-bar {
    background: linear-gradient(to bottom, #e8d5a3, #d4be82);
    border-bottom: 2px solid #b8972e;
    padding: 6px 16px;
    position: sticky;
    top: 42px;
    z-index: 999;
}

.resource-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.village-selector {
    font-size: 13px;
}

.village-selector select {
    padding: 3px 8px;
    border: 1px solid #b8972e;
    border-radius: 3px;
    background: #fdf5e6;
    color: #3e2b1a;
    font-size: 14px;
}

.resources {
    display: flex;
    gap: 18px;
    font-size: 15px;
    font-weight: 700;
}

.resource {
    cursor: help;
    white-space: nowrap;
}

.resource span {
    color: #3e2b1a;
}

/* ==========================================
   Building Navigation
   ========================================== */
.building-nav {
    background: linear-gradient(to bottom, #6b4423, #5c3d1a);
    border-bottom: 2px solid #8b6914;
    padding: 4px 8px;
    overflow-x: auto;
    position: sticky;
    top: 74px;
    z-index: 998;
}

.building-nav-inner {
    display: flex;
    gap: 2px;
    max-width: 1200px;
    margin: 0 auto;
    justify-content: center;
}

.building-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    color: #d4be82;
    text-decoration: none;
    min-width: 65px;
    transition: background 0.2s;
}

.building-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f0d78c;
    text-decoration: none;
}

.building-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.building-icon {
    font-size: 20px;
    line-height: 1;
}

.building-name {
    font-size: 11px;
    margin-top: 3px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65px;
    color: #f0d78c;
    font-weight: 600;
}

.building-level {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ==========================================
   Queue Bar (Compact - in header area)
   ========================================== */
.queue-bar-compact {
    background: #fff8e1;
    border: 2px solid #d4a843;
    border-radius: 6px;
    margin-bottom: 12px;
    overflow: hidden;
    font-size: 12px;
}

.queue-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 12px;
    background: linear-gradient(to bottom, #e8d5a3, #d4be82);
    font-weight: 700;
    font-size: 12px;
    color: #5c3d1a;
    border-bottom: 1px solid #c4a265;
}

.queue-detail-link {
    font-size: 11px;
    font-weight: 600;
    color: #5c3d1a;
}

.queue-bar-items {
    padding: 4px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.queue-bar-item {
    padding: 3px 6px;
    border-radius: 3px;
    background: #fdf5e6;
}

.queue-bar-item.queue-active {
    background: #f0e8d0;
    border: 1px solid #d4be82;
}

.queue-bar-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.queue-bar-name {
    font-weight: 600;
    color: #3e2b1a;
}

.queue-bar-name small {
    font-weight: 400;
    color: #8b6914;
    margin-left: 2px;
}

.queue-bar-time {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.cancel-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e0d0b0;
    color: #96281b;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
    line-height: 1;
    transition: background 0.2s;
}

.cancel-x:hover {
    background: #c0392b;
    color: #fff;
    text-decoration: none;
}

/* ==========================================
   Progress Bars
   ========================================== */
.progress-bar-wrap {
    height: 4px;
    background: #e0d5c0;
    border-radius: 2px;
    margin-top: 3px;
    overflow: hidden;
}

.progress-bar-wrap .progress-bar {
    height: 100%;
    background: linear-gradient(to right, #6b8e23, #8bc34a);
    border-radius: 2px;
    transition: width 1s linear;
}

/* Detailed progress bar (headquarters table) */
.progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar-bg {
    flex: 1;
    height: 18px;
    background: #e8dcc0;
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid #c4a265;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9px;
    background: linear-gradient(to right, #7cb342, #8bc34a, #aed581);
    transition: width 1s linear;
    position: relative;
    min-width: 0;
}

.progress-bar-fill.progress-animated {
    background: linear-gradient(to right, #558b2f, #7cb342, #8bc34a);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

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

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

    100% {
        transform: translateX(100%);
    }
}

.progress-pct {
    font-size: 11px;
    font-weight: 700;
    color: #5c3d1a;
    min-width: 50px;
    text-align: right;
}

/* Queue table specific */
.queue-row-active {
    background: #f0ead0 !important;
}

.queue-row-active td {
    border-color: #c4a265 !important;
}

.level-badge {
    display: inline-block;
    padding: 1px 8px;
    background: linear-gradient(to bottom, #6b8e23, #558b2f);
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.countdown-queue {
    font-size: 13px;
}

.btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f5e0e0;
    color: #c0392b;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid #e0b0b0;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #c0392b;
    color: #fff;
    text-decoration: none;
}

/* Old queue bar kept for compatibility */
.queue-bar {
    background: #fff8e1;
    border: 1px solid #d4a843;
    border-radius: 4px;
    padding: 6px 12px;
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
}

.queue-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cancel-link {
    font-size: 10px;
    opacity: 0.7;
}

.cancel-link:hover {
    opacity: 1;
}

/* ==========================================
   Container
   ========================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
}

/* ==========================================
   Content Boxes
   ========================================== */
.content-box {
    background: #fdf5e6;
    border: 2px solid #c4a265;
    border-radius: 6px;
    margin-bottom: 16px;
    overflow: hidden;
}

.content-box-header {
    background: linear-gradient(to bottom, #6b4423, #5c3d1a);
    color: #f0d78c;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 14px;
    border-bottom: 2px solid #8b6914;
}

.content-box-body {
    padding: 12px 14px;
}

/* ==========================================
   Tables
   ========================================== */
.game-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.game-table th {
    background: linear-gradient(to bottom, #d4be82, #c4a265);
    color: #3e2b1a;
    padding: 6px 10px;
    text-align: left;
    font-weight: 700;
    border: 1px solid #b8972e;
    white-space: nowrap;
}

.game-table td {
    padding: 6px 10px;
    border: 1px solid #d4be82;
    vertical-align: middle;
}

.game-table tr:nth-child(even) {
    background: #f5ecd3;
}

.game-table tr:hover {
    background: #efe0b9;
}

.game-table .text-center {
    text-align: center;
}

.game-table .text-right {
    text-align: right;
}

.game-table .no-resources {
    color: #c0392b;
}

.game-table .has-resources {
    color: #2e7d32;
}

/* ==========================================
   Building Page
   ========================================== */
.building-info {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.building-icon-large {
    font-size: 48px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8d5a3;
    border-radius: 8px;
    border: 2px solid #c4a265;
}

.building-details h2 {
    color: #5c3d1a;
    margin-bottom: 4px;
}

.building-details p {
    color: #6b4423;
    font-size: 12px;
}

/* Cost display */
.cost-display {
    display: inline-flex;
    gap: 12px;
    font-size: 12px;
}

.cost-item {
    white-space: nowrap;
}

.cost-item.insufficient {
    color: #c0392b;
    font-weight: 700;
}

/* ==========================================
   Training Page
   ========================================== */
.train-input {
    width: 60px;
    padding: 3px 6px;
    border: 1px solid #c4a265;
    border-radius: 3px;
    text-align: center;
    font-size: 12px;
}

.troop-icon {
    font-size: 18px;
}

/* ==========================================
   Map
   ========================================== */
.map-container {
    overflow: hidden;
    border: 2px solid #8b6914;
    border-radius: 4px;
    background: #a8c68f;
    margin-bottom: 12px;
}

.map-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 12px;
    flex-wrap: wrap;
}

.map-coords {
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-coords input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #c4a265;
    border-radius: 3px;
    text-align: center;
    font-size: 12px;
}

.map-grid {
    display: grid;
    gap: 0;
    border: 1px solid #7a9a5a;
}

.map-cell {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    position: relative;
    transition: background 0.1s;
}

.map-cell:hover {
    outline: 2px solid #ff0;
    z-index: 10;
}

/* Village cell backgrounds removed - terrain texture shows through */
.map-cell.has-village,
.map-cell.own-village,
.map-cell.barbarian-village,
.map-cell.enemy-village {
    background: transparent;
    border-color: transparent;
}

.map-cell .village-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.3);
}

.map-cell.own-village .village-dot {
    background: #4caf50;
}

.map-cell.barbarian-village .village-dot {
    background: #8d6e63;
}

.map-cell.enemy-village .village-dot {
    background: #e53935;
}

.map-header-cell {
    background: #d4be82;
    font-weight: 700;
    font-size: 9px;
    color: #5c3d1a;
    cursor: default;
}

.map-header-cell:hover {
    outline: none;
}

.map-tooltip {
    position: absolute;
    background: #fdf5e6;
    border: 2px solid #8b6914;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 11px;
    z-index: 100;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.map-tooltip h4 {
    margin-bottom: 4px;
    color: #5c3d1a;
}

.map-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 11px;
    padding: 8px 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

/* ==========================================
   Reports
   ========================================== */
.report-win {
    color: #2e7d32;
    font-weight: 700;
}

.report-lose {
    color: #c0392b;
    font-weight: 700;
}

.report-unread {
    font-weight: 700;
    background: #fff8e1;
}

.report-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.report-side h3 {
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #c4a265;
}

.troop-lost {
    color: #c0392b;
    text-decoration: line-through;
}

.troop-survived {
    color: #2e7d32;
    font-weight: 700;
}

/* ==========================================
   Overview Page
   ========================================== */
.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.overview-building-list {
    list-style: none;
}

.overview-building-list li {
    padding: 4px 0;
    border-bottom: 1px solid #e8d5a3;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.overview-building-list li:last-child {
    border-bottom: none;
}

/* ==========================================
   Countdown timer
   ========================================== */
.countdown {
    font-weight: 700;
    color: #8b6914;
    font-family: 'Courier New', monospace;
}

/* ==========================================
   Forms
   ========================================== */
.form-inline {
    display: flex;
    gap: 8px;
    align-items: center;
}

input[type="number"] {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid #c4a265;
    border-radius: 3px;
    font-size: 12px;
}

select {
    padding: 4px 8px;
    border: 1px solid #c4a265;
    border-radius: 3px;
    background: #fdf5e6;
    font-size: 12px;
}

/* ==========================================
   Ranking
   ========================================== */
.rank-1 {
    font-weight: 700;
    font-size: 14px;
}

.rank-2 {
    font-weight: 600;
    font-size: 13px;
}

.rank-3 {
    font-weight: 600;
}

/* ==========================================
   Rally Point - Attack Form
   ========================================== */
.attack-form {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    align-items: center;
}

.attack-form label {
    font-weight: 600;
    text-align: right;
}

/* Training Table Modern-Classic Redesign */
.troop-train-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin-top: 15px;
    background: #fdf5e6;
    border: 2px solid #c4a265;
    border-radius: 8px;
    overflow: hidden;
}

.troop-train-table th {
    background: #e8d5a3;
    color: #5c3d1a;
    padding: 12px 10px;
    font-size: 13px;
    font-weight: 800;
    border-bottom: 2px solid #c4a265;
    text-align: left;
}

.troop-train-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e8d5a3;
    vertical-align: middle;
}

.troop-train-table tr:last-child td {
    border-bottom: none;
}

.troop-locked {
    opacity: 0.6;
    background: #f2e9d0 !important;
}

.resource-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.res-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    color: #3e2b1a;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.4);
}

.res-item.insufficient {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.1);
}

.res-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
}

/* Base resource icons if needed or just use emojis for better compatibility */
.res-wood::before {
    content: "🪵";
}

.res-clay::before {
    content: "🧱";
}

.res-iron::before {
    content: "⛏️";
}

.res-pop::before {
    content: "👥";
}

.troop-train-table .train-input {
    width: 70px !important;
    height: 32px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    border: 2px solid #c4a265;
    border-radius: 4px;
    padding: 0 5px;
}

.troop-train-table .max-label {
    font-size: 11px;
    color: #8b6914;
    font-weight: 700;
    cursor: pointer;
    margin-left: 5px;
    text-decoration: underline;
}

.troop-train-table .max-label:hover {
    color: #c0392b;
}

.btn-train-all {
    margin-top: 15px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 4px 0 #8b6914;
    transition: all 0.1s;
    float: right;
}

.building-link {
    text-decoration: none;
    color: #4a2c1a;
    transition: color 0.2s;
}

.building-link:hover {
    color: #8b6914;
    text-decoration: underline;
}

.badge-success {
    background-color: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-train-all:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #8b6914;
}

.train-time-cell {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #3e2b1a;
}

/* ==========================================
   Footer
   ========================================== */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px;
    color: #8b6914;
    font-size: 11px;
    border-top: 2px solid #c4a265;
    background: linear-gradient(to bottom, #fdf5e6, #e8d5a3);
    z-index: 1100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* ==========================================
   Utilities
   ========================================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-success {
    color: #2e7d32;
}

.text-danger {
    color: #c0392b;
}

.text-warning {
    color: #e65100;
}

.text-muted {
    color: #8b6914;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.fw-bold {
    font-weight: 700;
}

.d-flex {
    display: flex;
}

.gap-8 {
    gap: 8px;
}

.gap-16 {
    gap: 16px;
}

.flex-between {
    justify-content: space-between;
}

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 768px) {
    .overview-grid {
        grid-template-columns: 1fr;
    }

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

    .top-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .top-bar-center {
        gap: 10px;
        flex-wrap: wrap;
    }

    .resources {
        gap: 8px;
        flex-wrap: wrap;
    }

    .building-nav-inner {
        justify-content: flex-start;
    }

    .map-cell {
        width: 30px;
        height: 30px;
    }
}

/* ==========================================
   Animations
   ========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Button loading state */
button:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ==========================================
   Training Queue - Enhanced Styles
   ========================================== */
.train-queue-box {
    background: linear-gradient(to bottom, #fff8e1, #fff3cc);
    border: 2px solid #f0c040;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.train-queue-header {
    background: linear-gradient(to bottom, #f57c00, #e65100);
    color: #fff;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #bf360c;
}

.train-queue-header .queue-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
}

.train-queue-body {
    padding: 8px 12px;
}

.train-queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #ffe082;
    margin-bottom: 6px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.train-queue-item:last-child {
    margin-bottom: 0;
}

.train-queue-item.queue-active {
    background: linear-gradient(to right, #fff8e1, #fff3cc);
    border-color: #f0c040;
    box-shadow: 0 2px 8px rgba(240, 192, 64, 0.3);
}

.train-queue-item .tq-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

.train-queue-item .tq-info {
    flex: 1;
    min-width: 0;
}

.train-queue-item .tq-name {
    font-weight: 700;
    color: #3e2b1a;
    font-size: 13px;
}

.train-queue-item .tq-count {
    display: inline-block;
    background: linear-gradient(to bottom, #f57c00, #e65100);
    color: #fff;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
}

.train-queue-item .tq-time {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #e65100;
    font-size: 14px;
}

.train-queue-item .tq-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(to right, #f57c00, #ffb300);
    border-radius: 0 0 6px 6px;
    transition: width 1s linear;
}

.train-queue-item .tq-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fce4e4;
    color: #c62828;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid #ef9a9a;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.train-queue-item .tq-cancel:hover {
    background: #c62828;
    color: #fff;
    text-decoration: none;
}

/* Troop training table enhancements */
.troop-train-table th {
    font-size: 11px;
}

.troop-train-table td {
    vertical-align: middle;
}

.troop-train-table .troop-name-cell {
    white-space: nowrap;
}

.troop-train-table .troop-name-cell .troop-icon-lg {
    font-size: 20px;
    vertical-align: middle;
    margin-right: 4px;
}

.troop-train-table .troop-count-cell {
    text-align: center;
    font-weight: 700;
    font-size: 14px;
}

.troop-train-table .troop-count-cell.has-troops {
    color: #2e7d32;
}

.troop-train-table .troop-count-cell.no-troops {
    color: #9e9e9e;
}

.troop-train-table .cost-cell {
    text-align: center;
    font-size: 12px;
}

.troop-train-table .cost-cell.insufficient {
    color: #c62828;
    font-weight: 700;
}

.troop-train-table .cost-cell.sufficient {
    color: #2e7d32;
}

.troop-train-table .train-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.troop-train-table .train-actions .train-input {
    width: 52px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 4px;
    border: 2px solid #f0c040;
    border-radius: 4px;
    background: #fffde7;
}

.troop-train-table .train-actions .train-input:focus {
    border-color: #f57c00;
    outline: none;
    box-shadow: 0 0 5px rgba(245, 124, 0, 0.3);
}

.troop-train-table .btn-train {
    background: linear-gradient(to bottom, #43a047, #2e7d32);
    color: #fff;
    border: 2px solid #1b5e20;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.troop-train-table .btn-train:hover {
    background: linear-gradient(to bottom, #4caf50, #43a047);
}

.troop-train-table .btn-max {
    background: linear-gradient(to bottom, #f0c040, #d4a843);
    color: #3e2b1a;
    border: 1px solid #c49000;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.troop-train-table .btn-max:hover {
    background: linear-gradient(to bottom, #f7e5a0, #f0c040);
}

.troop-locked {
    opacity: 0.5;
    background: #f5f5f5 !important;
}

.troop-locked td {
    color: #9e9e9e;
}

/* ==========================================
   Battle Report - Result Banner
   ========================================== */
.battle-result-banner {
    width: 100%;
    max-width: 420px;
    height: auto;
    display: block;
    margin: 0 auto 20px auto;
    border-radius: 8px;
    mix-blend-mode: multiply;
    /* Removes white background from JPEG */
    filter: drop-shadow(0 10px 15px rgba(62, 43, 26, 0.4));
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.battle-result-banner:hover {
    transform: scale(1.02);
}

.banner-parchment-wrap {
    padding: 10px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    margin-bottom: 5px;
    display: flex;
    justify-content: center;
    position: relative;
}

.report-result-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.report-result-label.result-win {
    background: linear-gradient(to bottom, #4caf50, #2e7d32);
    color: #fff;
    border: 1px solid #1b5e20;
}

.report-result-label.result-lose {
    background: linear-gradient(to bottom, #f44336, #c62828);
    color: #fff;
    border: 1px solid #8e0000;
}

/* Report list enhancements */
.report-list-icon {
    width: 32px;
    text-align: center;
}

.report-list-icon img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

/* ==========================================
   Attack Notification Bar
   ========================================== */
.attack-bar {
    background: linear-gradient(to bottom, #c0392b, #96281b);
    border-bottom: 2px solid #7b1f15;
    padding: 5px 16px;
    animation: attackPulse 2s infinite;
}

.attack-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.attack-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attack-bar-icon {
    font-size: 18px;
    animation: attackShake 0.5s infinite alternate;
}

.attack-bar-text {
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.attack-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes attackPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

@keyframes attackShake {
    0% {
        transform: rotate(-5deg);
    }

    100% {
        transform: rotate(5deg);
    }
}

/* Outgoing bar */
.outgoing-bar {
    background: linear-gradient(to bottom, #1565c0, #0d47a1);
    border-bottom: 2px solid #0a3d91;
    padding: 4px 16px;
}

/* Attack Detail Panel */
.attack-panel {
    background: #fdf5e6;
    border: 2px solid #c0392b;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-width: 1200px;
    margin: 0 auto;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
    overflow: hidden;
}

.attack-panel-header {
    background: linear-gradient(to bottom, #5c3d1a, #3e2b1a);
    color: #f0d78c;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.attack-panel-body {
    padding: 10px 14px;
    max-height: 400px;
    overflow-y: auto;
}

@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }

    to {
        max-height: 600px;
        opacity: 1;
    }
}

/* Attack detail table */
.attack-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 10px;
}

.attack-detail-table th {
    background: linear-gradient(to bottom, #d4be82, #c4a265);
    color: #3e2b1a;
    padding: 5px 8px;
    text-align: left;
    font-weight: 700;
    border: 1px solid #b8972e;
    white-space: nowrap;
    font-size: 11px;
}

.attack-detail-table td {
    padding: 5px 8px;
    border: 1px solid #d4be82;
    vertical-align: middle;
}

.attack-detail-table tr:nth-child(even) {
    background: #f5ecd3;
}

.attack-detail-table .atk-incoming {
    background: #fce4e4;
}

.attack-detail-table .atk-incoming:nth-child(even) {
    background: #f8d7d7;
}

.attack-detail-table .atk-outgoing {
    background: #e3f2fd;
}

.attack-detail-table .atk-outgoing:nth-child(even) {
    background: #d6ebfc;
}

.attack-detail-table .atk-returning {
    background: #e8f5e9;
}

.attack-detail-table .atk-returning:nth-child(even) {
    background: #d9eeda;
}

.attack-countdown {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #c0392b;
    font-size: 12px;
}

.attack-countdown.outgoing {
    color: #1565c0;
}

.attack-countdown.returning {
    color: #2e7d32;
}

.section-label {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 0 3px 0;
    color: #5c3d1a;
    border-bottom: 2px solid #c4a265;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.atk-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
}

.atk-badge-danger {
    background: #c0392b;
}

.atk-badge-info {
    background: #1565c0;
}

.atk-badge-success {
    background: #2e7d32;
}

/* ==========================================
   Advanced Report UI
   ========================================== */
.report-troop-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.troop-item-card {
    background: #fdf5e6;
    border: 1px solid #c4a265;
    border-radius: 6px;
    padding: 8px 4px;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.troop-item-card:hover {
    transform: translateY(-2px);
    border-color: #8b6914;
}

.troop-item-icon {
    font-size: 24px;
    margin-bottom: 4px;
    display: block;
}

.troop-item-count {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: #3e2b1a;
}

.troop-item-lost {
    display: block;
    font-size: 11px;
    color: #c0392b;
    font-weight: 600;
}

.troop-item-lost.no-loss {
    color: #8b6914;
    opacity: 0.5;
}

.troop-item-tag {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #6b4423;
    color: #f0d78c;
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 700;
}

/* Loot Cards */
.loot-cards {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.loot-card {
    background: linear-gradient(135deg, #fdf5e6 0%, #f5ecd3 100%);
    border: 1px solid #c4a265;
    border-radius: 8px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 120px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
}

.loot-card i {
    font-size: 20px;
}

.loot-card-info {
    display: flex;
    flex-direction: column;
}

.loot-card-label {
    font-size: 10px;
    color: #8b6914;
    text-transform: uppercase;
}

.loot-card-value {
    font-weight: 700;
    font-size: 14px;
    color: #3e2b1a;
}

/* Damage Panel */
.damage-panel {
    background: #fff8e1;
    border: 1px dashed #c4a265;
    border-radius: 6px;
    padding: 10px;
    margin-top: 12px;
}

.damage-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 4px 0;
}

.damage-item:not(:last-child) {
    border-bottom: 1px solid rgba(196, 162, 101, 0.2);
}

/* ==========================================
   Rally Point - Attack Command Center
   ========================================== */
.rally-command-center {
    background: linear-gradient(135deg, #fdf5e6 0%, #f5ecd3 100%);
    border: 2px solid #8b6914;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.rally-target-section {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid #4caf50;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.rally-target-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.rally-target-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.rally-target-inputs label {
    font-weight: 700;
    color: #2e7d32;
    font-size: 14px;
}

.rally-target-inputs input {
    width: 70px;
    padding: 10px 12px;
    border: 2px solid #4caf50;
    border-radius: 8px;
    background: #fff;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    color: #2e7d32;
    transition: all 0.2s;
}

.rally-target-inputs input:focus {
    outline: none;
    border-color: #1b5e20;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

.rally-divider {
    color: #4caf50;
    font-weight: 700;
    font-size: 18px;
}

.rally-troops-section {
    margin-bottom: 20px;
}

.rally-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #c4a265;
}

.rally-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #5c3d1a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rally-troops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.rally-troop-card {
    background: linear-gradient(135deg, #fff 0%, #fdf5e6 100%);
    border: 2px solid #c4a265;
    border-radius: 10px;
    padding: 14px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.rally-troop-card:hover {
    border-color: #8b6914;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 105, 20, 0.2);
}

.rally-troop-card.selected {
    border-color: #4caf50;
    background: linear-gradient(135deg, #fff 0%, #e8f5e9 100%);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.rally-troop-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.rally-troop-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #f0c040, #d4a843);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    overflow: hidden;
}

/* Troop Icon Images */
.troop-icon-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    vertical-align: middle;
}

.troop-icon-img-sm {
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle;
}

.rally-troop-info {
    flex: 1;
    min-width: 0;
}

.rally-troop-name {
    font-weight: 700;
    font-size: 14px;
    color: #3e2b1a;
    margin-bottom: 2px;
}

.rally-troop-available {
    font-size: 12px;
    color: #8b6914;
}

.rally-troop-available a {
    color: #2e7d32;
    font-weight: 700;
    text-decoration: none;
}

.rally-troop-available a:hover {
    text-decoration: underline;
}

.rally-troop-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rally-troop-input {
    flex: 1;
    padding: 8px 10px;
    border: 2px solid #c4a265;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    color: #3e2b1a;
    transition: all 0.2s;
}

.rally-troop-input:focus {
    outline: none;
    border-color: #8b6914;
    box-shadow: 0 0 5px rgba(139, 105, 20, 0.3);
}

.rally-btn-max {
    padding: 6px 12px;
    background: linear-gradient(to bottom, #f0c040, #d4a843);
    border: 1px solid #c49000;
    border-radius: 6px;
    color: #3e2b1a;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rally-btn-max:hover {
    background: linear-gradient(to bottom, #f7e5a0, #f0c040);
}

.rally-attack-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #c0392b, #96281b);
    border: 2px solid #7b1f15;
    border-radius: 10px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 6px 20px rgba(192, 57, 43, 0.3);
}

.rally-attack-btn:hover {
    background: linear-gradient(135deg, #d35400, #c0392b);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(192, 57, 43, 0.4);
}

.rally-attack-btn:active {
    transform: translateY(0);
}

.rally-btn-select-all {
    padding: 8px 16px;
    background: linear-gradient(to bottom, #f0c040, #d4a843);
    border: 2px solid #c49000;
    border-radius: 6px;
    color: #3e2b1a;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rally-btn-select-all:hover {
    background: linear-gradient(to bottom, #f7e5a0, #f0c040);
    text-decoration: none;
}

@media (max-width: 600px) {
    .rally-troops-grid {
        grid-template-columns: 1fr;
    }

    .rally-target-section {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .rally-target-inputs {
        justify-content: center;
    }
}