/* Farm Wave System - RTL (Arabic) */
/* Card-style design inspired by Travian Nova hero server cards */

/* ========== Spawn Progress Overlay ========== */
.fw-spawn-overlay {
    padding: 8px 6px;
    text-align: center;
    direction: rtl;
}

.fw-spawn-title {
    font-weight: bold;
    font-size: 12px;
    color: #2a6e00;
    margin-bottom: 8px;
    animation: fw-pulse 1.5s ease-in-out infinite;
}

.fw-spawn-bar-wrap {
    background: #ddd;
    border: 1px solid #999;
    border-radius: 4px;
    height: 18px;
    margin: 0 4px 6px;
    position: relative;
    overflow: hidden;
}

.fw-spawn-bar {
    background: linear-gradient(to bottom, #f7b733, #fc4a1a);
    height: 100%;
    width: 0%;
    transition: width 0.6s ease;
    border-radius: 3px;
}

.fw-spawn-bar.fw-done {
    background: linear-gradient(to bottom, #6c3, #390);
}

.fw-spawn-bar-label {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    text-align: center;
    line-height: 18px;
    font-size: 10px;
    font-weight: bold;
    color: #333;
    text-shadow: 0 0 2px rgba(255,255,255,0.8);
}

.fw-spawn-count {
    font-size: 11px;
    color: #444;
    margin-bottom: 4px;
    direction: rtl;
}

.fw-spawn-count strong {
    color: #070;
    font-size: 13px;
}

.fw-spawn-msg {
    font-size: 10px;
    color: #666;
    margin-top: 4px;
    min-height: 14px;
}

.fw-spawn-done-msg {
    font-weight: bold;
    color: #2a6e00;
    font-size: 12px;
    margin-top: 6px;
    animation: fw-fadeIn 0.5s ease;
}

/* ========== Next Wave Transition ========== */
.fw-next-wave {
    text-align: center;
    padding: 8px 5px 4px;
    margin-top: 6px;
    border-top: 1px dashed #c5a55a;
    animation: fw-fadeIn 0.5s ease;
}

.fw-next-wave-text {
    font-size: 11px;
    font-weight: bold;
    color: #7a5c2a;
    margin-bottom: 4px;
}

.fw-dots {
    display: inline-block;
    min-width: 20px;
    text-align: right;
    letter-spacing: 1px;
}

.fw-next-wave-timer {
    font-size: 16px;
    font-weight: bold;
    color: #b00;
    direction: ltr;
    margin-top: 2px;
}

/* ========== Main Widget ========== */
.fw-widget {
    overflow: hidden;
    font-size: 11px;
    direction: rtl;
}

.fw-center {
    text-align: center;
    padding: 15px 5px;
    color: #666;
}

.fw-all-done {
    color: #090;
    font-weight: bold;
    margin-bottom: 8px;
}

/* ========== Card Row (generic row) ========== */
.fw-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.fw-row-label {
    font-weight: bold;
    font-size: 11px;
    color: #4a3728;
}

.fw-row-value {
    font-size: 11px;
    color: #555;
}

/* ========== Current Event Row ========== */
.fw-event-row {
    background: linear-gradient(160deg, #d4ba8b 0%, #e9d2a8 100%);
    border-radius: 6px;
    margin: 0 -27px 6px;
    padding: 2px 7px;
    border: 1px solid #c5a55a;
    border-left: none;
    border-right: none;
    flex-wrap: nowrap;
    gap: 0;
    justify-content: flex-start;
}

.fw-event-row .fw-row-label {
    color: #000;
    font-size: 11px;
    text-shadow: 0px 0px 7px rgb(255, 165, 0);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 4px;
}

.fw-event-name {
    font-weight: bold;
    font-size: 13px;
    color: #8f0202;
    text-shadow: 1px 1px 5px rgb(255, 255, 255);
    white-space: nowrap;
}

/* ========== Wave Stepper Bar ========== */
.fw-stepper {
    display: flex;
    align-items: center;
    margin: 1px 0px 11px;
    padding: 0px;
    direction: rtl;
}

/* Segment bar between circles */
.fw-stepper-seg {
    flex: 1;
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0;
}

.fw-seg-track {
    width: 100%;
    height: 4px;
    background: #c8bca0;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);
}

.fw-seg-fill {
    width: 0%;
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.fw-seg-filled .fw-seg-fill {
    width: 100%;
    background: linear-gradient(to bottom, #6db340, #4a8f2f);
    box-shadow: 0 0 4px rgba(74,143,47,0.3);
}

.fw-seg-empty .fw-seg-fill {
    width: 0%;
}

.fw-step {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.fw-step-node {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    cursor: default;
}

.fw-step-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    transition: filter 0.3s ease;
}

/* Locked step — dimmed */
.fw-step-locked .fw-step-img {
    filter: grayscale(80%) brightness(0.7);
    opacity: 0.5;
}

/* Active step — glowing + bright */
.fw-step-active .fw-step-img {
    filter: brightness(1.2);
}

.fw-step-active .fw-step-node {
    animation: fw-step-glow 2s ease-in-out infinite;
    border-radius: 50%;
}

/* Countdown step — subtle glow */
.fw-step-countdown .fw-step-node {
    animation: fw-step-glow 2.5s ease-in-out infinite;
    border-radius: 50%;
}

/* Completed step — grayscale + check badge */
.fw-step-completed .fw-step-img {
    filter: grayscale(100%) brightness(0.85);
    opacity: 0.6;
}

.fw-step-check-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: linear-gradient(160deg, #6db340, #4a8f2f);
    border: 1.5px solid #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgb(0, 0, 0);
    line-height: 1;
    box-shadow: 0 1px 9px rgb(0, 0, 0);
}

/* Glow animation for active/countdown */
@keyframes fw-step-glow {
    0%, 100% { box-shadow: 0 0 6px rgba(197,165,90,0.4); }
    50% { box-shadow: 0 0 14px rgba(197,165,90,0.9); }
}

/* Tooltip (rendered on body via JS to escape overflow:hidden) */
.fw-step-tooltip {
    display: none;
}

.fw-step-tooltip-float {
    position: fixed;
    background: linear-gradient(160deg, #fdf6e3, #ede0c4);
    border: 1px solid #c5a55a;
    border-radius: 6px;
    padding: 6px 10px;
    min-width: 140px;
    box-shadow: 0 4px 12px rgba(101,67,10,0.3);
    z-index: 99999;
    direction: rtl;
    text-align: right;
    pointer-events: none;
    animation: fw-fadeIn 0.15s ease;
}

.fw-step-tooltip-float::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #c5a55a;
}

.fw-step-tooltip-title {
    font-weight: bold;
    font-size: 12px;
    color: #7a5c2a;
    margin-bottom: 2px;
    text-align: center;
}

.fw-step-tooltip-name {
    font-size: 10px;
    color: #8f0202;
    font-weight: bold;
    text-align: center;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(197,165,90,0.3);
}

.fw-step-tooltip-row {
    font-size: 10px;
    color: #555;
    padding: 1px 0;
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

.fw-step-tooltip-row strong {
    color: #3d2600;
}

/* ========== Combined Progress Bar ========== */
.fw-progress-combined {
    position: relative;
    background-color: #d1c0a5;
    border: 1px solid #705d42;
    border-radius: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    height: 30px;
    margin: 4px 5px 2px;
    overflow: hidden;
}

.fw-progress-combined .fw-progress-bar {
    height: 100%;
    transition: width 0.5s ease-in-out;
    border-radius: 3px;
    border-left: 1px solid #5e4a2d;
    position: absolute;
    top: 0;
    right: 0;
    background: 
        linear-gradient(to bottom, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 50%),
        linear-gradient(to bottom, #76b325 0%, #4d7a16 100%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.2) 0%, rgba(0, 0, 0, 0.1) 100%);
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.5), 
        inset 0 -1px 2px rgba(0, 0, 0, 0.3),
        0 0 8px rgba(118, 179, 37, 0.4);
}

.fw-progress-info {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    z-index: 2;
    direction: ltr;
}

.fw-progress-target {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    -webkit-text-stroke: 2px #3d2b1f;
    paint-order: stroke fill;
}

.fw-progress-sep {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    -webkit-text-stroke: 2px #3d2b1f;
    paint-order: stroke fill;
}

.fw-progress-current {
    font-size: 15px;
    font-weight: 700;
    color: #f00;
    -webkit-text-stroke: 2px #ddd;
    paint-order: stroke fill;
}

.fw-progress-pct {
    position: absolute;
    bottom: 0;
    left: 2px;
    font-size: 8px;
    font-weight: bold;
    color: #000;
    text-shadow: 1px 1px 1px rgba(244, 244, 244, 0.6);
    z-index: 2;
    line-height: 1;
    padding-bottom: 1px;
}

/* ========== Rewards Row ========== */
.fw-prize-line {
    text-align: center;
    margin: 1px 5px 4px;
}

.fw-prize-value {
    color: #175d27 !important;
    font-weight: bold;
}

/* ========== Leader Row ========== */
.fw-leader-row {
    margin: 0 5px;
    transition: background 0.2s;
}
.fw-leader-row:hover {
    background: linear-gradient(160deg, #d4ba8b 0%, #e9d2a8 100%);
    border-radius: 4px;
}

/* ========== Stats Footer ========== */
.fw-stats-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    background: linear-gradient(160deg, #d4ba8b 0%, #e9d2a8 100%);
    border-radius: 6px;
    margin: 6px 5px 4px;
    padding: 6px 10px;
    border: 1px solid #c5a55a;
}

.fw-stats-label {
    font-weight: bold;
    font-size: 11px;
    color: #fff;
}

.fw-stats-value {
    direction: ltr;
    font-weight: bold;
    font-size: 12px;
    color: #543602;
}

#fwActiveFarms {
    color: #16481c;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
}

/* ========== Countdown ========== */
.fw-countdown-wrap {
    text-align: center;
    padding: 8px 5px;
}

.fw-countdown-title {
    margin-bottom: 6px;
    font-weight: bold;
    color: #4a3728;
}

.fw-countdown-timer {
    font-size: 18px;
    font-weight: bold;
    color: #b00;
    direction: ltr;
}

.fw-countdown-desc {
    margin-top: 6px;
    color: #555;
}

/* ========== Animations ========== */
@keyframes fw-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes fw-fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Leaderboard Modal ========== */
.fw-lb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    direction: rtl;
}
.fw-lb-modal {
    position: relative;
    width: 520px;
    max-width: 95vw;
    overflow: visible;
    background: linear-gradient(160deg, #fdf6e3 0%, #ede0c4 100%);
    border: 1px solid #c5a55a;
    border-top: 3px solid #c5a55a;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(101, 67, 10, 0.3);
    animation: fw-fadeIn 0.25s ease;
}
.fw-lb-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #c5a55a;
    justify-content: right;
}
.fw-lb-header .wp-card-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c5a55a, #8b6120);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,.2);
    flex-shrink: 0;
    overflow: hidden;
}
.fw-lb-header .wp-card-badge img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}
.fw-lb-title {
    flex: 1;
    font-size: 16px;
    color: #7a5c2a;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .4px;
    line-height: 1.3;
}
.fw-lb-close {
    color: #8b6120;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
    font-weight: bold;
}
.fw-lb-close:hover {
    color: #c0392b;
}
.fw-lb-body {
    padding: 12px 16px;
}
.fw-lb-loading {
    text-align: center;
    padding: 30px;
    color: #7a5c2a;
    font-weight: bold;
}

/* Section */
.fw-lb-section {
    margin-bottom: 14px;
}
.fw-lb-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: right;
    margin-bottom: 8px;
}
.fw-lb-badge-sm {
    width: 28px !important;
    height: 28px !important;
}
.fw-lb-badge-sm img {
    width: 24px !important;
    height: 24px !important;
}
.fw-lb-section-header .wp-card-header {
    font-size: 13px;
    color: #7a5c2a;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* Row list */
.fw-lb-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fw-lb-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    background: linear-gradient(160deg, #faf0d8 0%, #f0e4c6 100%);
    border: 1px solid #dfd3ad;
    transition: background .15s, transform .15s;
}
.fw-lb-row-first {
    background: linear-gradient(160deg, #f5e2b0 0%, #e8d292 100%);
    border-color: #c5a55a;
}
.fw-lb-row:not(.fw-lb-row-header):hover {
    background: linear-gradient(160deg, #f5e8c2 0%, #e8d8aa 100%);
    transform: scale(1.01);
}
.fw-lb-row-header {
    background: linear-gradient(135deg, #c5a55a, #8b6120);
    border-color: #8b6120;
    padding: 4px 10px;
}
.fw-lb-row-header > div {
    font-size: 10px;
    color: rgba(255,255,255,.9) !important;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .3px;
}
/* Rank cell (nova-round-num style) */
.fw-lb-col-rank {
    min-width: 28px;
    max-width: 28px;
    text-align: center;
}
.fw-lb-rank-cell {
    background: linear-gradient(135deg, #c5a55a, #8b6120);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
}
.fw-lb-rank-num {
    font-size: 15px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.fw-lb-row-header .fw-lb-col-rank {
    min-width: 28px;
}
.fw-lb-col-name {
    flex: 1;
    font-size: 12px;
    font-weight: bold;
    color: #3d2600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.fw-lb-col-score {
    min-width: 60px;
    text-align: center;
}
.fw-lb-score-badge {
    font-size: 11px;
    font-weight: bold;
    color: #0b0909;
    background: rgb(229, 206, 155);
    box-shadow: 0 0 6px rgb(144, 109, 13);
    border: 1px solid rgba(2, 1, 0, .3);
    border-radius: 6px;
    padding: 2px 8px;
    display: inline-block;
}
.fw-lb-col-status {
    min-width: 60px;
    font-size: 11px;
    color: #7a5c2a;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Medals — removed, using rank numbers instead */

/* Personal */
.fw-lb-personal {
    text-align: center;
    margin-top: 4px;
    padding: 12px;
    background: linear-gradient(160deg, #fdf6e3 0%, #ede0c4 100%);
    border: 2px solid #c5a55a;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(101, 67, 10, .15);
}
.fw-lb-personal-title {
    font-size: 10px;
    color: #7a5c2a;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 6px;
}
.fw-lb-personal-value {
    font-size: 18px;
    font-weight: bold;
    color: #0b0909;
    background: rgb(229, 206, 155);
    box-shadow: 0 0 8px rgb(144, 109, 13);
    border: 1px solid rgba(2, 1, 0, .3);
    border-radius: 12px;
    padding: 4px 16px;
    display: inline-block;
}
