/* =============================================
   ADMIN PANEL - RESPONSIVE & MOBILE CSS
   IKPLUS Online Platform
   ============================================= */

/* ===== ADMIN PANEL BASE RESPONSIVE ===== */
@media (max-width: 768px) {
    /* Admin Container */
    .admin-container {
        padding: 0.75rem 0.5rem !important;
    }

    /* Admin Header */
    .admin-header {
        padding: 1.25rem !important;
        margin-bottom: 1rem !important;
        border-radius: 8px !important;
    }

    .admin-header h1 {
        font-size: 1.3rem !important;
    }

    .admin-header p {
        font-size: 0.85rem !important;
    }

    /* Page Header - Stack vertically */
    .page-header,
    [style*="justify-content: space-between"][style*="align-items: center"][style*="margin-bottom: 2rem"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .page-header h2,
    [style*="font-size: 1.75rem"] {
        font-size: 1.3rem !important;
    }

    /* Stats Row */
    .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        margin-bottom: 1rem !important;
    }

    .stat-card {
        padding: 1rem !important;
    }

    .stat-card h3 {
        font-size: 1.4rem !important;
    }

    .stat-card p {
        font-size: 0.75rem !important;
    }

    /* Action Buttons - Scroll horizontal */
    .action-buttons {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 0.5rem !important;
        margin-bottom: 1rem !important;
        padding-bottom: 0.5rem !important;
        scrollbar-width: none !important;
    }

    .action-buttons::-webkit-scrollbar {
        display: none !important;
    }

    .btn-action {
        padding: 0.6rem 1rem !important;
        font-size: 0.8rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        border-radius: 8px !important;
    }

    /* Courses Card */
    .courses-card {
        border-radius: 8px !important;
    }

    .courses-card-header {
        padding: 0.875rem 1rem !important;
        font-size: 0.95rem !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .courses-card-header [style*="min-width: 280px"] {
        min-width: 100% !important;
        width: 100% !important;
    }

    /* Tables - Card View on Mobile */
    .courses-table thead,
    .admin-table thead {
        display: none !important;
    }

    .courses-table tbody tr,
    .admin-table tbody tr {
        display: block !important;
        background: white !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 10px !important;
        margin-bottom: 0.75rem !important;
        padding: 0.75rem !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
    }

    .courses-table tbody td,
    .admin-table tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.4rem 0.5rem !important;
        border-bottom: 1px solid #f1f5f9 !important;
        font-size: 0.85rem !important;
    }

    .courses-table tbody td:last-child,
    .admin-table tbody td:last-child {
        border-bottom: none !important;
        padding-top: 0.75rem !important;
    }

    .courses-table tbody td::before,
    .admin-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #475569;
        font-size: 0.8rem;
        flex-shrink: 0;
        margin-right: 0.5rem;
    }

    /* Thumbnail - Hide on mobile */
    .course-thumbnail,
    .course-thumbnail-placeholder {
        width: 50px !important;
        height: 35px !important;
    }

    /* Button Groups */
    .btn-group-sm {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0.4rem !important;
        justify-content: flex-end !important;
    }

    .btn-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.85rem !important;
    }

    /* Breadcrumb */
    [style*="margin-bottom: 1.5rem"] > a[style*="inline-flex"] {
        padding: 0.5rem 1rem !important;
        font-size: 0.8rem !important;
    }

    /* Admin Card */
    .admin-card {
        border-radius: 8px !important;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr 1fr !important;
    }

    .stat-card h3 {
        font-size: 1.2rem !important;
    }

    .btn-action {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important;
    }

    .btn-action i {
        font-size: 0.8rem !important;
    }
}

/* ===== ADMIN LIST PAGES RESPONSIVE ===== */
@media (max-width: 768px) {
    /* Action buttons in headers */
    .action-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important;
    }

    .action-btn-primary {
        padding: 0.5rem 1rem !important;
        font-size: 0.8rem !important;
    }

    /* Status badges */
    .status-badge {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.5rem !important;
    }

    /* Table links */
    .table-link {
        font-size: 0.85rem !important;
    }
}

/* ===== TOUCH-FRIENDLY ENHANCEMENTS ===== */
@media (pointer: coarse) {
    /* Larger touch targets */
    .btn-action,
    .action-btn,
    .btn-icon,
    .nav-link,
    .dropdown-toggle {
        min-height: 44px !important;
        min-width: 44px !important;
    }

    /* Remove hover effects on touch devices */
    .stat-card:hover {
        transform: none !important;
    }

    .courses-table tbody tr:hover,
    .admin-table tbody tr:hover {
        background: inherit !important;
    }

    /* Better tap feedback */
    .btn-action:active,
    .action-btn:active,
    .btn-icon:active {
        transform: scale(0.95) !important;
        opacity: 0.8 !important;
    }

    /* Scrollable areas indicators */
    .table-container {
        -webkit-overflow-scrolling: touch !important;
    }
}

/* ===== ADMIN PANEL GRID - Yönetim Butonları ===== */
@media (max-width: 768px) {
    /* Make admin buttons into a 2-column grid */
    .action-buttons {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
        overflow-x: visible !important;
    }

    .action-buttons .btn-action {
        white-space: normal !important;
        text-align: center !important;
        justify-content: center !important;
        padding: 0.75rem 0.5rem !important;
        font-size: 0.75rem !important;
        border-radius: 8px !important;
    }

    .action-buttons .btn-action i {
        display: block !important;
        margin: 0 auto 0.25rem !important;
        font-size: 1.1rem !important;
    }
}

/* ===== GENERAL MOBILE IMPROVEMENTS ===== */
@media (max-width: 768px) {
    /* Better form controls on mobile */
    input[type="text"],
    input[type="email"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    /* Better modal/overlay display */
    .modal-content {
        width: 95% !important;
        max-width: none !important;
        margin: 1rem !important;
    }

    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }

    /* No horizontal overflow */
    body {
        overflow-x: hidden !important;
    }
}

/* ===== PWA INSTALL PROMPT ===== */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.pwa-install-banner .pwa-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.pwa-install-banner .pwa-icon {
    font-size: 2rem;
}

.pwa-install-banner .pwa-text h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.pwa-install-banner .pwa-text p {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    opacity: 0.8;
}

.pwa-install-banner .pwa-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.pwa-install-btn {
    background: #FF4D00;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.pwa-install-btn:hover {
    background: #E64500;
}

.pwa-dismiss-btn {
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
}

.pwa-dismiss-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* ===== BOTTOM NAV BAR (MOBILE ADMIN) ===== */
.mobile-admin-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: none;
    justify-content: space-around;
    align-items: center;
    padding: 0.4rem 0;
    z-index: 9990;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}

.mobile-admin-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    text-decoration: none;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.mobile-admin-nav a i {
    font-size: 1.1rem;
}

.mobile-admin-nav a.active,
.mobile-admin-nav a:active {
    color: #FF4D00;
}

@media (max-width: 768px) {
    .mobile-admin-nav {
        display: flex !important;
    }

    /* Add bottom padding for mobile nav */
    .admin-container {
        padding-bottom: 70px !important;
    }
}
