/* ===================================
   FazendaRPG - Top Bar Styles
   Clean RPG-style header with themes
   =================================== */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 3px solid var(--border-color);
    box-shadow: 0 2px 10px var(--shadow-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 9999;
    gap: 6px;
    overflow: hidden;
}

/* Left Section: Avatar + Player Info */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

/* Avatar */
.topbar-avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(
        135deg,
        var(--brand-primary) 0%,
        var(--brand-secondary) 100%
    );
    border: 3px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 2px 8px var(--shadow-color);
    flex-shrink: 0;
}

/* Player Info Section - Card Style */
.topbar-player {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: linear-gradient(
        135deg,
        rgba(92, 170, 31, 0.15),
        rgba(126, 200, 80, 0.1)
    );
    padding: 3px 8px;
    border-radius: 8px;
    border: 1px solid rgba(92, 170, 31, 0.4);
    box-shadow: 0 1px 3px var(--shadow-color);
    min-width: 100px;
    flex: 1 1 auto;
    max-width: 160px;
    height: auto;
    transition: all 0.3s ease;
}

.topbar-player:hover {
    box-shadow: 0 2px 6px var(--shadow-color);
}

.topbar-player-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.topbar-player-level {
    font-size: 9px;
    color: #5caa1f;
    font-weight: 900;
    line-height: 1.3;
}

/* Farming XP Bar (compact) */
.topbar-farming-xp {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 0px;
}

.topbar-farming-bar {
    flex: 1;
    height: 5px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
}

.topbar-farming-text {
    font-size: 8px;
    color: var(--text-secondary);
    font-weight: 900;
    white-space: nowrap;
    line-height: 1.2;
    max-width: 45px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-farming-fill {
    height: 100%;
    background: linear-gradient(90deg, #5caa1f 0%, #7ec850 50%, #5caa1f 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
    box-shadow: 0 0 8px rgba(92, 170, 31, 0.6);
    position: relative;
}

.topbar-farming-fill::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent);
    border-radius: 3px 3px 0 0;
}

/* XP Bar */
/* XP Bar - REMOVED - Now using Farming skill level instead */
/*
.topbar-xp-container {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 120px;
}

.topbar-xp-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.topbar-xp-bar {
    width: 100%;
    height: 16px;
    background: var(--bg-accent);
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    box-shadow: inset 0 2px 4px var(--shadow-color);
}

.topbar-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db 0%, #5dade2 50%, #85c1e9 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.6);
    position: relative;
    overflow: hidden;
}

.topbar-xp-fill::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.topbar-xp-text {
    font-size: 10px;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 600;
}
*/

/* Stats (Gold & Energy) */
.topbar-stats {
    display: flex;
    gap: 6px;
    align-items: center;
    flex: 0 0 auto;
    justify-content: flex-end;
    overflow: hidden;
}

.topbar-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: var(--bg-accent);
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px var(--shadow-color);
    min-width: 80px;
    max-width: 110px;
    transition: all 0.3s ease;
    flex-shrink: 1;
}

.topbar-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.topbar-stat-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.topbar-stat-icon {
    font-size: 18px;
}

.topbar-stat-value {
    font-size: 13px;
    font-weight: 900;
    color: var(--text-primary);
    white-space: nowrap;
    display: inline;
    line-height: 1.2;
    text-align: center;
}

/* Gold */
.topbar-gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    border-color: #f39c12;
    position: relative;
    overflow: hidden;
}

.topbar-gold::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: goldShine 3s infinite;
}

@keyframes goldShine {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.topbar-gold .topbar-stat-value {
    color: #b8860b;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
    font-weight: 900;
}

.topbar-gold .topbar-stat-icon {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* Energy */
.topbar-energy {
    border-color: #5caa1f;
    border-width: 1px;
}

/* Energy - Light Theme (mais transparente) */
.light-theme .topbar-energy {
    background: rgba(255, 255, 255, 0.7);
}

.light-theme .topbar-energy .topbar-stat-icon {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.topbar-energy .topbar-stat-value {
    color: #5caa1f;
    font-weight: 900;
}

/* Energy Progress Bar */
.topbar-energy-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-accent);
    border-radius: 3px;
    overflow: hidden;
    border: 0.5px solid #5caa1f;
    box-shadow: inset 0 1px 2px var(--shadow-color);
    margin-top: 1px;
}

.topbar-energy-fill {
    height: 100%;
    background: linear-gradient(90deg, #5caa1f 0%, #7ec850 50%, #9ed97f 100%);
    border-radius: 4px;
    transition:
        width 0.3s ease,
        background 0.3s ease;
    box-shadow: 0 0 10px rgba(92, 170, 31, 0.6);
    position: relative;
}

.topbar-energy-fill::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 4px 4px 0 0;
}

.topbar-energy-fill.low {
    background: linear-gradient(90deg, #e74c3c 0%, #c0392b 50%, #e74c3c 100%);
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.6);
    animation: pulseLow 1.5s infinite;
}

.topbar-energy-fill.medium {
    background: linear-gradient(90deg, #f39c12 0%, #e67e22 50%, #f39c12 100%);
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.6);
}

@keyframes pulseLow {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Menu Toggle */
.menu-toggle {
    width: 42px;
    height: 42px;
    background: var(--brand-primary);
    border: 2px solid var(--brand-secondary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(92, 170, 31, 0.3);
}

.menu-toggle:hover {
    background: var(--brand-secondary);
    border-color: var(--brand-tertiary);
    box-shadow: 0 4px 12px rgba(92, 170, 31, 0.4);
}

.menu-toggle:active {
    transform: scale(0.95);
}

.hamburger {
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    position: relative;
    transition: all 0.3s ease;
}

.hamburger::before,
.hamburger::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    left: 0;
    transition: all 0.3s ease;
}

.hamburger::before {
    top: -7px;
}

.hamburger::after {
    bottom: -7px;
}

.menu-toggle.active .hamburger {
    background: transparent;
}

.menu-toggle.active .hamburger::before {
    top: 0;
    transform: rotate(45deg);
}

.menu-toggle.active .hamburger::after {
    bottom: 0;
    transform: rotate(-45deg);
}

/* Side Menu */
.side-menu {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    max-height: 100vh;
    background: linear-gradient(135deg, #654321 0%, #5a3d1f 40%, #4a3218 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: -6px 0 30px var(--shadow-color);
    border-radius: 0;
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border-left: 3px solid rgba(139, 105, 20, 0.6);
    border-bottom: 3px solid rgba(139, 105, 20, 0.6);
}

.side-menu.active {
    right: 0;
    border-left: 3px solid var(--brand-primary);
    border-bottom: 3px solid var(--brand-primary);
    box-shadow:
        -6px 0 30px var(--shadow-color),
        -3px 0 15px rgba(92, 170, 31, 0.3),
        0 3px 15px rgba(92, 170, 31, 0.3);
}

/* Menu Header - Estilo Card */
.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 15px;
    background: linear-gradient(
        135deg,
        var(--brand-primary) 0%,
        var(--brand-secondary) 100%
    );
    color: white;
    border-bottom: 3px solid var(--brand-tertiary);
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.menu-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.menu-logo {
    font-size: 36px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.menu-title-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 1px;
    line-height: 1.2;
}

.menu-subtitle {
    margin: 0;
    font-size: 11px;
    opacity: 0.9;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.menu-close {
    position: relative;
    right: 0;
    width: 32px;
    height: 32px;
    background: rgba(220, 53, 69, 0.9);
    border: 2px solid rgba(200, 35, 51, 0.8);
    border-radius: 8px;
    color: white;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 0;
    padding: 0;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
    flex-shrink: 0;
}

.menu-close:hover {
    background: #c82333;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.6);
}

/* Menu Navigation */
.menu-nav {
    padding: 20px 15px;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
    background: transparent;
}

/* Custom Scrollbar for Menu */
.menu-nav::-webkit-scrollbar {
    width: 8px;
}

.menu-nav::-webkit-scrollbar-track {
    background: var(--bg-accent);
    border-radius: 10px;
    margin: 10px 0;
}

.menu-nav::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        var(--brand-primary) 0%,
        var(--brand-secondary) 100%
    );
    border-radius: 10px;
    border: 2px solid var(--bg-accent);
}

.menu-nav::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        var(--brand-secondary) 0%,
        var(--brand-tertiary) 100%
    );
}

/* Menu Sections */
.menu-section {
    margin-bottom: 25px;
}

.menu-section-title {
    font-size: 13px;
    font-weight: 800;
    color: #f4e4c1;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 12px 5px;
    padding-bottom: 6px;
    border-bottom: 2px solid rgba(139, 105, 20, 0.5);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Menu Items - Estilo Card moderno */
.menu-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 12px;
    background: linear-gradient(135deg, #8b6914 0%, #a0522d 40%, #654321 100%);
    border: 2px solid rgba(139, 105, 20, 0.6);
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    font-family: inherit;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.menu-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--brand-primary);
    transform: scaleY(0);
    transition: transform 0.25s ease;
}

.menu-item:hover {
    background: linear-gradient(135deg, #a0522d 0%, #8b6914 40%, #654321 100%);
    border-color: var(--brand-primary);
    transform: translateX(-6px);
    box-shadow:
        6px 0 16px rgba(92, 170, 31, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.menu-item:hover::before {
    transform: scaleY(1);
}

.menu-item:active {
    transform: translateX(-3px) scale(0.98);
}

.menu-item.active {
    background: linear-gradient(
        135deg,
        var(--brand-primary) 0%,
        var(--brand-secondary) 100%
    );
    color: white;
    border-color: var(--brand-tertiary);
    box-shadow: 0 4px 12px rgba(92, 170, 31, 0.4);
}

.menu-item.active::before {
    transform: scaleY(1);
    background: white;
}

.menu-item.active .menu-item-title,
.menu-item.active .menu-item-desc {
    color: white;
}

/* Menu Item Icon */
.menu-item-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 2px solid rgba(139, 105, 20, 0.4);
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.25s ease;
}

.menu-item:hover .menu-item-icon {
    background: rgba(92, 170, 31, 0.2);
    border-color: var(--brand-primary);
    transform: scale(1.05);
}

.menu-item.active .menu-item-icon {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.menu-item-icon.city-icon {
    font-size: 24px;
}

/* Menu Item Content */
.menu-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    align-items: center;
    text-align: center;
}

.menu-item-title {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.menu-item-desc {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    opacity: 0.9;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Deprecated - Manter para compatibilidade */
.menu-icon {
    font-size: 24px;
    min-width: 32px;
    text-align: center;
}

.menu-text {
    font-weight: 600;
    font-size: 16px;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Menu Animations */
@keyframes slideInRight {
    from {
        right: -320px;
        opacity: 0;
    }
    to {
        right: 0;
        opacity: 1;
    }
}

.side-menu.active {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    font-size: 10px;
    font-weight: 900;
    padding: 3px 6px;
    border-radius: 10px;
    border: 2px solid var(--bg-primary);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
    min-width: 18px;
    text-align: center;
    z-index: 10;
}

.menu-item.highlighted {
    animation: menuItemPulse 1.5s infinite;
}

@keyframes menuItemPulse {
    0%,
    100% {
        box-shadow: 0 2px 4px var(--shadow-color);
    }
    50% {
        box-shadow: 0 4px 16px rgba(92, 170, 31, 0.4);
    }
}

/* Responsive */

/* Specific fix for 430x932 and similar resolutions */
@media (max-width: 430px) and (min-width: 400px) {
    .topbar {
        gap: 4px;
        padding: 0 6px;
    }

    .topbar-left {
        gap: 5px;
        flex: 0 0 auto;
    }

    .topbar-player {
        min-width: 85px;
        flex: 1 1 auto;
        max-width: 120px;
        padding: 3px 6px;
    }

    .topbar-player-name {
        font-size: 10px;
    }

    .topbar-player-level {
        font-size: 8px;
    }

    .topbar-farming-text {
        font-size: 7px;
    }

    .topbar-stats {
        gap: 5px;
        flex: 0 0 auto;
    }

    .topbar-stat {
        min-width: 70px;
        max-width: 90px;
        padding: 5px 8px;
    }

    .topbar-stat-value {
        font-size: 11px;
    }

    .menu-toggle {
        width: 38px;
        height: 38px;
    }
}
@media (max-width: 768px) {
    .topbar {
        height: 55px;
        padding: 0 10px;
        gap: 6px;
    }

    .topbar-avatar {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .topbar-player-name {
        font-size: 11px;
    }

    .topbar-player-level {
        font-size: 9px;
    }

    .topbar-farming-text {
        font-size: 8px;
    }

    /* XP Container removed */

    .topbar-stat {
        padding: 6px 10px;
        min-width: 75px;
    }

    .topbar-stat-icon {
        font-size: 16px;
    }

    .topbar-stat-value {
        font-size: 12px;
    }

    .menu-toggle {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .topbar {
        gap: 5px;
        padding: 0 8px;
    }

    .topbar-player {
        min-width: 80px;
        max-width: 110px;
        padding: 2px 6px;
    }

    .topbar-player-name {
        font-size: 10px;
    }

    .topbar-player-level {
        font-size: 8px;
    }

    .topbar-farming-bar {
        height: 4px;
    }

    .topbar-farming-text {
        font-size: 7px;
        max-width: 40px;
    }

    /* XP Container removed */

    .topbar-stats {
        gap: 5px;
    }

    .topbar-stat {
        padding: 4px 8px;
        min-width: 65px;
    }

    .topbar-energy-bar {
        height: 5px;
    }
}

/* Animations */
@keyframes pulseGold {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

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

.topbar-gold.updated {
    animation: pulseGold 0.4s ease;
}

.topbar-energy.updated {
    animation: pulseEnergy 0.3s ease;
}
