/* =============================================
   FETİH - MOBİL MENÜ VE TAB BAR
   Alt navigasyon ve mobil optimizasyonlar
   ============================================= */

/* =============================================
   MOBİL PANEL OVERLAY
   ============================================= */
.mobile-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.mobile-panel {
    background: linear-gradient(135deg, #1a2634, #0d1520);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.mobile-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-panel-header h2 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

.mobile-panel-close {
    background: rgba(239, 68, 68, 0.2);
    border: none;
    color: #ef4444;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-panel-close:hover {
    background: rgba(239, 68, 68, 0.4);
}

.mobile-panel-content {
    padding: 15px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

/* Mobil panel içindeki ordu grupları */
.mobile-panel-content .army-group-header {
    cursor: pointer;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-panel-content .army-group-header:active {
    background: rgba(255, 255, 255, 0.15);
}

.mobile-panel-content .army-group-details {
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 10px;
}

.mobile-panel-content .army-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 5px;
}

.mobile-panel-content .army-item:last-child {
    margin-bottom: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================
   MOBİL (768px ve altı)
   ============================================= */
@media screen and (max-width: 768px) {
    
    /* Üst bar'ı kompakt yap */
    #top-bar {
        padding: 8px 10px;
        flex-wrap: nowrap;
        gap: 10px;
        overflow: visible !important;
    }
    
    #top-bar .logo {
        font-size: 14px;
    }
    
    #top-bar .resources {
        gap: 12px;
        overflow: visible !important;
    }
    
    #top-bar .resource {
        font-size: 12px;
    }
    
    #top-bar .resource .icon {
        font-size: 14px;
    }
    
    #top-bar .resource .rate {
        font-size: 10px;
    }
    
    /* Ekonomi Tooltip Mobil - Gereksiz, Kaynaklar sekmesinde var */
    .economy-tooltip {
        display: none !important;
    }
    
    /* Mobilde anlaşma göstergesini gizle - yer kazanmak için */
    #active-deals {
        display: none !important;
    }
    
    /* Mobilde header menü butonunu gizle - alt barda var */
    .header-menu-btn {
        display: none !important;
    }
    
    /* Sol panel gizle */
    #left-panel {
        display: none !important;
    }
    
    /* Ana panel tam genişlik */
    #main-panel,
    #center-panel {
        width: 100% !important;
        max-width: 100% !important;
        padding: 5px !important;
        margin: 0 !important;
    }
    
    /* Ana içerik */
    #main-content {
        padding: 5px !important;
        padding-bottom: 65px !important;
        min-height: calc(100vh - 50px);
    }
    
    /* ÜST TAB BUTONLARINI GİZLE - Alt bar kullanacağız */
    #tabs {
        display: none !important;
    }
    
    /* Tab içerikleri - normal akış */
    .tab-content {
        padding: 5px !important;
    }
    
    /* Aktif tab görünsün */
    .tab-content.active {
        display: block !important;
    }
    
    /* ===== HARİTA MOBİL ===== */
    #tab-map {
        padding: 0 !important;
        position: relative;
        height: calc(100vh - 120px);
        overflow: hidden;
    }
    
    /* Harita başlığını gizle */
    .hex-map-header {
        display: none !important;
    }
    
    /* Legend bar gizle */
    .hex-legend-bar {
        display: none !important;
    }
    
    /* Görünüm butonları - sabit pozisyon */
    .map-view-controls {
        position: fixed !important;
        top: 50px;
        left: 0;
        right: 0;
        z-index: 100;
        background: rgba(15, 20, 30, 0.95);
        padding: 8px 10px;
        display: flex !important;
        justify-content: center;
        gap: 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .map-view-controls .view-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Harita container */
    .hex-map-container {
        width: 100%;
        height: calc(100vh - 170px) !important;
        max-height: calc(100vh - 170px) !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 0 !important;
        margin: 0 !important;
        margin-top: 45px !important;
    }
    
    /* Harita wrapper */
    .hex-map-wrapper {
        width: 100% !important;
        min-height: 100%;
        display: flex;
        align-items: flex-start;
        justify-content: center;
    }
    
    /* Harita - doğal boyut */
    #hex-map {
        transform: none !important;
        transform-origin: center center;
    }
    
    /* Harita SVG - fit */
    #hex-map svg {
        max-width: 100%;
        height: auto;
    }
    
    /* Alt kontrolleri gizle */
    .map-bottom-bar,
    .map-zoom-controls,
    .zoom-slider-container {
        display: none !important;
    }
    
    /* ===== ALT TAB BAR ===== */
    #mobile-tab-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(to top, rgba(15, 20, 30, 0.98), rgba(20, 25, 35, 0.95));
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 12px 5px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        z-index: 9000;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
        justify-content: space-around;
        align-items: center;
    }
    
    .mobile-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 14px;
        background: transparent;
        border: none;
        color: rgba(255, 255, 255, 0.5);
        font-size: 10px;
        cursor: pointer;
        transition: all 0.2s;
        border-radius: 10px;
        min-width: 55px;
    }
    
    .mobile-tab .tab-icon {
        font-size: 24px;
        margin-bottom: 4px;
    }
    
    .mobile-tab .tab-label {
        font-size: 10px;
        white-space: nowrap;
    }
    
    .mobile-tab.active {
        color: #fff;
        background: rgba(255, 255, 255, 0.1);
    }
    
    .mobile-tab.active .tab-icon {
        transform: scale(1.1);
    }
    
    .mobile-tab:active {
        transform: scale(0.95);
    }
    
    /* Daha butonu */
    .mobile-more-btn .tab-icon {
        transition: transform 0.3s;
    }
    
    .mobile-more-btn.open .tab-icon {
        transform: rotate(180deg);
    }
    
    /* ===== DAHA FAZLA MENÜ ===== */
    .mobile-more-menu {
        position: absolute;
        bottom: 65px;
        right: 10px;
        background: rgba(20, 25, 35, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 12px;
        padding: 8px;
        display: flex;
        flex-direction: column;
        gap: 5px;
        min-width: 150px;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
        animation: slideUp 0.2s ease;
        z-index: 9100;
    }
    
    .mobile-more-menu.hidden {
        display: none;
    }
    
    @keyframes slideUp {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .more-menu-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 15px;
        background: rgba(255, 255, 255, 0.05);
        border: none;
        border-radius: 8px;
        color: #fff;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.2s;
        text-align: left;
    }
    
    .more-menu-item:hover,
    .more-menu-item:active {
        background: rgba(255, 255, 255, 0.15);
    }
    
    .more-menu-item span {
        font-size: 18px;
    }
    
    /* Menü ayracı */
    .more-menu-divider {
        height: 1px;
        background: rgba(255, 255, 255, 0.1);
        margin: 5px 0;
    }
    
    /* Tehlikeli buton (Ana Menü) */
    .menu-item-danger {
        background: rgba(239, 68, 68, 0.2) !important;
        border: 1px solid rgba(239, 68, 68, 0.3) !important;
    }
    
    .menu-item-danger:hover,
    .menu-item-danger:active {
        background: rgba(239, 68, 68, 0.4) !important;
    }

    /* ===== ÜRETİM MOBİL ===== */
    #tab-production {
        padding: 10px !important;
        overflow-y: auto;
        overflow-x: hidden !important;
        max-height: calc(100vh - 120px);
        width: 100%;
        box-sizing: border-box;
    }
    
    .production-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 15px;
    }
    
    .production-header h2 {
        font-size: 18px;
        text-align: center;
    }
    
    .production-summary {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .prod-stat {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .prod-stat .prod-icon {
        font-size: 14px;
    }
    
    .production-section {
        padding: 10px;
        margin-bottom: 15px;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .production-section h3 {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .resource-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .resource-card {
        padding: 10px;
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .res-icon {
        width: 32px;
        height: 32px;
        font-size: 18px;
        flex-shrink: 0;
    }
    
    .res-info {
        overflow: hidden;
        min-width: 0;
    }
    
    .res-name {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .res-amount {
        font-size: 14px;
    }
    
    .res-rate {
        font-size: 10px;
    }
    
    .factory-grid {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .factory-card {
        width: 100% !important;
        padding: 12px;
        box-sizing: border-box;
    }
    
    .factory-icon {
        font-size: 24px;
    }
    
    .workforce-panel {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .workforce-box {
        width: 100% !important;
        padding: 10px;
        box-sizing: border-box;
    }
    
    .workforce-box h4 {
        font-size: 14px;
    }
    
    /* Tüm tab içerikleri için yatay scroll engelle */
    .tab-content {
        overflow-x: hidden !important;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* ===== ARAŞTIRMA MOBİL ===== */
    #tab-research {
        padding: 10px !important;
        overflow-y: auto;
        overflow-x: hidden !important;
        max-height: calc(100vh - 120px);
    }
    
    .research-header {
        flex-direction: column;
        gap: 10px;
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
    
    .research-header h2 {
        font-size: 18px;
        text-align: center;
    }
    
    .research-stats {
        display: flex;
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .research-stats .stat {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .research-stats .stat .icon {
        font-size: 14px;
    }
    
    .research-stats .stat .label {
        font-size: 10px;
    }
    
    /* Araştırma kategorileri - kompakt grid */
    .research-categories {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 15px;
    }
    
    .research-category-btn {
        padding: 10px 8px !important;
        min-width: auto !important;
        flex-direction: column;
        gap: 4px;
    }
    
    .research-category-btn .cat-icon {
        font-size: 20px !important;
    }
    
    .research-category-btn .cat-name {
        font-size: 11px !important;
        text-align: center;
    }
    
    .research-category-btn .cat-progress {
        font-size: 10px !important;
        padding: 2px 6px;
    }
    
    /* Aktif araştırma paneli */
    .research-active-panel {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .research-active-panel h3 {
        font-size: 14px;
    }
    
    /* Araştırma kartları */
    .research-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .research-card {
        width: 100% !important;
        padding: 12px !important;
    }
    
    .research-card .tech-icon {
        font-size: 24px;
    }
    
    .research-card .tech-name {
        font-size: 13px;
    }
    
    .research-card .tech-desc {
        font-size: 11px;
    }
    
    /* Seviye göstergesi */
    .research-level-indicator {
        font-size: 12px;
        padding: 8px;
    }
}

/* =============================================
   MASAÜSTÜ - MOBİL ELEMANLARI GİZLE
   ============================================= */
@media screen and (min-width: 769px) {
    #mobile-tab-bar {
        display: none !important;
    }
}

/* =============================================
   ÇOK KÜÇÜK EKRANLAR (480px ve altı)
   ============================================= */
@media screen and (max-width: 480px) {
    .mobile-tab {
        padding: 5px 8px;
        min-width: 45px;
    }
    
    .mobile-tab .tab-icon {
        font-size: 18px;
    }
    
    .mobile-tab .tab-label {
        font-size: 8px;
    }
    
    #top-bar .logo {
        display: none;
    }
    
    /* Araştırma kategorileri tek sütun */
    .research-categories {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .research-category-btn .cat-name {
        font-size: 10px !important;
    }
}

/* =============================================
   LANDSCAPE MODE
   ============================================= */
@media screen and (max-width: 896px) and (orientation: landscape) {
    #mobile-tab-bar {
        padding: 4px 10px;
    }
    
    .mobile-tab {
        flex-direction: row;
        gap: 5px;
        padding: 5px 10px;
    }
    
    .mobile-tab .tab-icon {
        font-size: 16px;
        margin-bottom: 0;
    }
    
    .mobile-tab .tab-label {
        font-size: 10px;
    }
    
    #main-content {
        padding-bottom: 50px !important;
    }
}
