/**
 * Responsive CSS untuk Website Sekolah & Semua Layanan
 * Support: Desktop, Tablet, Mobile
 */

/* ========================================
   MOBILE TOGGLE BUTTON
   ======================================== */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: linear-gradient(135deg, var(--primary-color, #667eea), var(--secondary-color, #764ba2));
    border: none;
    color: #fff;
    width: 45px;
    height: 45px;
    border-radius: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-toggle:hover {
    transform: scale(1.05);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ========================================
   TABLET (max-width: 992px)
   ======================================== */
@media (max-width: 992px) {
    /* Show mobile toggle */
    .mobile-toggle {
        display: flex;
    }
    
    /* Sidebar transforms */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Main content full width */
    .main-content {
        margin-left: 0 !important;
        padding: 20px !important;
        padding-top: 70px !important;
    }
    
    /* Footer adjustments */
    .footer-text,
    footer {
        margin-left: 0 !important;
    }
    
    /* Tables responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Cards */
    .card-custom,
    .card {
        margin-bottom: 15px;
    }
    
    /* Stats */
    .stat-card,
    .stat-mini {
        margin-bottom: 15px;
    }
    
    /* Form elements */
    .form-control,
    .form-select {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
    
    /* Buttons */
    .btn {
        padding: 10px 15px;
    }
    
    /* Modal */
    .modal-dialog {
        margin: 10px;
    }
}

/* ========================================
   MOBILE (max-width: 768px)
   ======================================== */
@media (max-width: 768px) {
    /* Typography */
    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.5rem; }
    h3, .h3 { font-size: 1.25rem; }
    h4, .h4 { font-size: 1.1rem; }
    
    /* Page title */
    .main-content h4 {
        font-size: 1.1rem;
    }
    
    /* Flex adjustments */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 15px;
    }
    
    /* Grid adjustments */
    .row > [class*="col-md-"],
    .row > [class*="col-lg-"] {
        margin-bottom: 15px;
    }
    
    /* Cards */
    .card-body {
        padding: 15px;
    }
    
    .card-header {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    /* Tables */
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 8px 10px;
        white-space: nowrap;
    }
    
    /* Hide certain columns on mobile */
    .table .d-none-mobile {
        display: none !important;
    }
    
    /* Buttons in tables */
    .table .btn {
        padding: 5px 8px;
        font-size: 0.75rem;
    }
    
    /* Button groups */
    .btn-group-mobile {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    /* Filter forms */
    .filter-form .row {
        gap: 10px;
    }
    
    .filter-form .col-md-2,
    .filter-form .col-md-3 {
        width: 100%;
    }
    
    /* Stats cards */
    .stat-card .number,
    .stat-mini .number {
        font-size: 1.5rem;
    }
    
    .stat-card .label,
    .stat-mini .label {
        font-size: 0.75rem;
    }
    
    /* Badges */
    .badge {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    /* Alerts */
    .alert {
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    
    /* Login containers */
    .login-container {
        padding: 25px 20px;
        margin: 10px;
    }
    
    /* Hero sections */
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    .hero-content p {
        font-size: 0.9rem;
    }
    
    /* Section titles */
    .section-title h2 {
        font-size: 1.5rem;
    }
    
    /* Navigation */
    .navbar {
        padding: 10px 15px;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
}

/* ========================================
   SMALL MOBILE (max-width: 480px)
   ======================================== */
@media (max-width: 480px) {
    /* Even smaller typography */
    h1, .h1 { font-size: 1.5rem; }
    h2, .h2 { font-size: 1.25rem; }
    h3, .h3 { font-size: 1.1rem; }
    
    /* Main content */
    .main-content {
        padding: 15px !important;
        padding-top: 65px !important;
    }
    
    /* Cards */
    .card-body {
        padding: 12px;
    }
    
    /* Tables - smaller text */
    .table {
        font-size: 0.8rem;
    }
    
    /* Stats in 2 columns */
    .row > .col-md-3,
    .row > .col-md-2 {
        width: 50%;
    }
    
    /* Hide action text, show only icons */
    .btn-action-text {
        display: none;
    }
    
    /* Student items */
    .student-item {
        padding: 10px;
    }
    
    .student-item img,
    .student-item .placeholder-img,
    .student-photo {
        width: 35px;
        height: 35px;
    }
    
    /* Login */
    .login-container {
        padding: 20px 15px;
    }
    
    .login-header .icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .login-header .app-name {
        font-size: 1.25rem;
    }
    
    /* Role selector */
    .role-selector {
        flex-wrap: wrap;
    }
    
    .role-btn {
        flex: 1 1 45%;
        padding: 10px;
    }
    
    .role-btn i {
        font-size: 1.1rem;
    }
    
    .role-btn span {
        font-size: 0.7rem;
    }
}

/* ========================================
   SIDEBAR MOBILE STYLES
   ======================================== */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        z-index: 1000;
        width: 260px;
        height: 100vh;
        overflow-y: auto;
    }
    
    .sidebar .brand {
        padding: 15px 20px;
        font-size: 1.1rem;
    }
    
    .sidebar .nav-link {
        padding: 10px 20px;
        margin: 3px 10px;
    }
    
    .sidebar .user-info {
        padding: 12px 20px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .sidebar,
    .mobile-toggle,
    .sidebar-overlay,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .card-custom {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ========================================
   TOUCH FRIENDLY
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
    }
    
    /* Remove hover effects */
    .btn:hover,
    .nav-link:hover,
    .card:hover {
        transform: none;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.text-truncate-mobile {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .text-truncate-mobile {
        max-width: 100px;
    }
    
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
    
    .full-width-mobile {
        width: 100% !important;
    }
    
    .stack-mobile {
        flex-direction: column !important;
    }
    
    .gap-mobile {
        gap: 10px !important;
    }
}

/* ========================================
   SCROLLBAR STYLING (for sidebar)
   ======================================== */
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 5px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}
