/* ===== KAPSAMLI MOBİL RESPONSIVE DÜZELTMELER ===== */
/* Tüm sayfalar için geçerli - site.css'den sonra yüklenir */

/* Genel overflow engelleme */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* =============================================
   MOBİL TOPBAR & SIDEBAR - Masaüstünde GİZLİ
   ============================================= */
.mobile-topbar {
    display: none;
}

.mobile-sidebar-header {
    display: none;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 998;
    transition: background 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    background: rgba(0, 0, 0, 0.6);
}

/* Eski hamburger butonu gizle */
.mobile-menu-toggle {
    display: none !important;
}


/* =========================================================
   768px ve altı - TABLET / MOBİL
   ========================================================= */
@media (max-width: 768px) {

    /* ===========================================
       MOBİL ÜST BAR (App Bar)
       =========================================== */
    .mobile-topbar {
        display: flex !important;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 52px;
        background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
        color: white;
        z-index: 997;
        padding: 0 12px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
        gap: 12px;
    }

    /* Hamburger Butonu */
    .mobile-hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.15);
        border: none;
        border-radius: 8px;
        cursor: pointer;
        gap: 4px;
        padding: 8px;
        transition: background 0.2s;
        flex-shrink: 0;
    }

    .mobile-hamburger:active {
        background: rgba(255, 255, 255, 0.3);
    }

    .hamburger-line {
        display: block;
        width: 18px;
        height: 2px;
        background: white;
        border-radius: 2px;
    }

    /* Topbar Başlık */
    .mobile-topbar-title {
        flex: 1;
        font-size: 15px;
        font-weight: 600;
        letter-spacing: 0.3px;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .mobile-topbar-icon {
        font-size: 18px;
    }

    /* Topbar Kullanıcı Avatarı */
    .mobile-topbar-user {
        flex-shrink: 0;
    }

    .mobile-user-avatar {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: rgba(255, 255, 255, 0.2);
        border: 2px solid rgba(255, 255, 255, 0.4);
        border-radius: 50%;
        font-size: 14px;
        font-weight: 700;
        color: white;
    }


    /* ===========================================
       MOBİL SIDEBAR (Slide-in Menü)
       =========================================== */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        width: 280px !important;
        min-width: 280px !important;
        max-width: 280px !important;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto !important;
        overflow-x: hidden !important;
        background: #fafafa !important;
        box-shadow: none;
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }

    /* Sidebar Header - Profil Kartı */
    .mobile-sidebar-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 16px;
        background: linear-gradient(135deg, #1b5e20 0%, #388e3c 100%);
        color: white;
        min-height: 72px;
    }

    .mobile-sidebar-profile {
        display: flex;
        align-items: center;
        gap: 12px;
        flex: 1;
        min-width: 0;
    }

    .mobile-profile-avatar {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.2);
        border: 2px solid rgba(255, 255, 255, 0.5);
        border-radius: 50%;
        font-size: 20px;
        font-weight: 700;
        color: white;
        flex-shrink: 0;
    }

    .mobile-profile-info {
        min-width: 0;
    }

    .mobile-profile-name {
        font-size: 14px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-profile-role {
        font-size: 11px;
        opacity: 0.8;
        margin-top: 2px;
    }

    /* Kapatma Butonu */
    .mobile-sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: rgba(255, 255, 255, 0.15);
        border: none;
        border-radius: 50%;
        color: white;
        font-size: 16px;
        cursor: pointer;
        flex-shrink: 0;
        transition: background 0.2s;
    }

    .mobile-sidebar-close:active {
        background: rgba(255, 255, 255, 0.3);
    }

    /* Sidebar içinde logo gizle (profil kartı yerine geçiyor) */
    .sidebar .logo-banner {
        display: none !important;
    }

    .sidebar .logo-title {
        display: none !important;
    }

    /* Dönem Seçici - Mobil */
    .sidebar .donem-secici {
        padding: 12px 16px !important;
        background: #f0f0f0;
        border-bottom: 1px solid #e0e0e0;
        margin: 0;
    }

    .sidebar .donem-secici label {
        font-size: 11px;
        color: #666;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 6px;
        display: block;
    }

    .sidebar .donem-secici select {
        width: 100%;
        padding: 8px 12px;
        border: 1px solid #ccc;
        border-radius: 8px;
        font-size: 13px;
        background: white;
    }

    .salt-okunur-uyari {
        font-size: 11px !important;
        padding: 4px 8px;
        margin-top: 6px;
        border-radius: 4px;
        background: #fff3cd;
        color: #856404;
    }

    /* Nav Menü - Mobil Tasarım */
    .sidebar .nav-menu {
        padding: 8px 0 !important;
        margin: 0 !important;
        list-style: none;
    }

    .sidebar .nav-menu>li {
        margin: 0;
    }

    .sidebar .nav-menu>li>a {
        display: flex;
        align-items: center;
        padding: 12px 20px !important;
        font-size: 14px !important;
        color: #333;
        text-decoration: none;
        transition: background 0.15s;
        border-left: 3px solid transparent;
    }

    .sidebar .nav-menu>li>a:active,
    .sidebar .nav-menu>li>a:hover {
        background: #e8f5e9;
        border-left-color: #2e7d32;
    }

    /* Menü Grupları */
    .sidebar .nav-group {
        border-top: 1px solid #eee;
    }

    .sidebar .nav-group:first-child {
        border-top: none;
    }

    .sidebar .nav-group-header {
        display: flex;
        align-items: center;
        padding: 12px 20px !important;
        font-size: 14px !important;
        font-weight: 600;
        color: #333;
        cursor: pointer;
        transition: background 0.15s;
        gap: 8px;
        user-select: none;
    }

    .sidebar .nav-group-header:active {
        background: #f5f5f5;
    }

    .sidebar .nav-group-header .arrow {
        margin-left: auto;
        font-size: 10px;
        color: #999;
    }

    /* Alt menü öğeleri */
    .sidebar .nav-group ul {
        list-style: none;
        padding: 0 !important;
        margin: 0;
        background: #f8f8f8;
    }

    .sidebar .nav-group ul li a {
        display: block;
        padding: 10px 20px 10px 44px !important;
        font-size: 13px !important;
        color: #555;
        text-decoration: none;
        transition: background 0.15s;
        border-left: 3px solid transparent;
    }

    .sidebar .nav-group ul li a:active,
    .sidebar .nav-group ul li a:hover {
        background: #e8f5e9;
        border-left-color: #43a047;
        color: #1b5e20;
    }

    /* Çıkış Butonu */
    .sidebar .nav-cikis {
        border-top: 1px solid #e0e0e0;
        margin-top: 8px;
        padding-top: 8px;
    }

    .sidebar .nav-cikis a {
        display: flex;
        align-items: center;
        padding: 12px 20px !important;
        font-size: 14px !important;
        color: #c62828 !important;
        font-weight: 600;
        text-decoration: none;
        transition: background 0.15s;
    }

    .sidebar .nav-cikis a:active {
        background: #ffebee;
    }


    /* ===========================================
       ANA LAYOUT
       =========================================== */
    .layout {
        display: flex !important;
        flex-direction: column !important;
        min-height: 100vh;
    }

    .content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        padding: 60px 10px 10px 10px !important;
        overflow-x: hidden;
    }

    /* Sayfa başlıkları */
    h1 {
        font-size: 16px !important;
        word-wrap: break-word;
        margin-top: 0 !important;
    }

    h3 {
        font-size: 15px !important;
    }


    /* ===========================================
       GENEL: Inline Grid'leri Mobilde Tek Sütuna Çevir
       =========================================== */
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns: 1fr 200px"] {
        grid-template-columns: 1fr !important;
    }

    [style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    }


    /* ===========================================
       STATUS BAR (Footer)
       =========================================== */
    .status-bar {
        flex-wrap: wrap !important;
        height: auto !important;
        padding: 6px 10px !important;
        font-size: 10px !important;
        gap: 2px 10px !important;
    }

    .status-separator {
        display: none !important;
    }

    .status-spacer {
        display: none !important;
    }

    .status-right {
        margin-left: 0 !important;
    }


    /* ===========================================
       TABLOLAR
       =========================================== */
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px;
    }

    table {
        font-size: 11px !important;
    }


    /* ===========================================
       FORMLAR
       =========================================== */
    .form-row {
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .form-row.three-cols {
        grid-template-columns: 1fr !important;
    }

    .form-group {
        width: 100% !important;
        flex: none !important;
    }

    .form-card {
        padding: 10px !important;
        margin: 0 !important;
    }

    .fieldset-section {
        padding: 10px !important;
    }

    fieldset {
        padding: 10px !important;
        margin-bottom: 12px !important;
    }


    /* ===========================================
       TAB BUTONLARI
       =========================================== */
    .tab-container {
        flex-direction: column !important;
        gap: 4px !important;
    }

    .tab-btn {
        width: 100% !important;
        text-align: center;
        border-radius: 6px !important;
        padding: 10px !important;
    }


    /* ===========================================
       AVANS DAĞITIM SAYFASI
       =========================================== */
    .kisi-layout {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .filter-row {
        flex-direction: column !important;
        gap: 6px !important;
    }

    .filter-row input {
        width: 100% !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .stat-card {
        padding: 8px !important;
    }

    .stat-value {
        font-size: 1rem !important;
    }

    .result-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }


    /* ===========================================
       BUTONLAR & INPUT'LAR
       =========================================== */
    .button-group {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .button-group .btn {
        width: 100% !important;
    }

    .input-group-custom {
        flex-direction: column !important;
    }

    .input-suffix {
        border-left: 1px solid #ccc !important;
        border-radius: 0 0 4px 4px !important;
        text-align: center;
    }

    .input-group-custom input {
        border-radius: 4px 4px 0 0 !important;
    }

    select,
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="password"] {
        max-width: 100% !important;
        width: 100% !important;
    }


    /* ===========================================
       DİĞER SAYFA ÖĞELERİ
       =========================================== */
    .alert {
        font-size: 12px !important;
        padding: 8px !important;
        word-wrap: break-word;
    }

    .selected-info {
        flex-direction: column !important;
        gap: 8px !important;
        align-items: flex-start !important;
    }

    .info-row {
        flex-direction: column !important;
        gap: 4px !important;
    }

    .toolbar {
        flex-wrap: wrap !important;
        gap: 4px !important;
    }

    .modal-content,
    .dialog-content {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 10px auto !important;
    }

    .report-filters,
    .filter-panel {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .pagination {
        flex-wrap: wrap !important;
        gap: 4px !important;
        justify-content: center !important;
    }

    .dashboard-cards,
    .dashboard-stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .print-btn-group {
        flex-direction: column !important;
        gap: 4px !important;
    }
}


/* =========================================================
   480px ve altı - KÜÇÜK MOBİL
   ========================================================= */
@media (max-width: 480px) {

    .content {
        padding: 56px 6px 6px 6px !important;
    }

    h1 {
        font-size: 14px !important;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .dashboard-cards,
    .dashboard-stats {
        grid-template-columns: 1fr !important;
    }

    .result-grid {
        grid-template-columns: 1fr !important;
    }

    .data-table th,
    .data-table td {
        padding: 6px 4px !important;
    }

    .status-bar {
        font-size: 9px !important;
        padding: 2px 4px !important;
    }

    .sidebar {
        width: 260px !important;
        min-width: 260px !important;
        max-width: 260px !important;
    }

    select,
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="password"] {
        font-size: 16px !important;
    }

    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .mobile-topbar {
        height: 48px;
    }
}


/* =========================================================
   Login sayfası mobil düzeltmeler
   ========================================================= */
@media (max-width: 480px) {
    .login-container {
        padding: 10px !important;
    }

    .login-card {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 8px !important;
    }

    .login-header {
        padding: 12px !important;
    }

    .login-header h2 {
        font-size: 12px !important;
    }

    .login-header p {
        font-size: 13px !important;
    }

    .login-form {
        padding: 16px !important;
    }

    .btn-block {
        padding: 12px !important;
        font-size: 14px !important;
    }
}