/**
 * Responsive CSS untuk Sistem Surat Keterangan Sekolah
 * Mobile-First Approach
 */

/* Extra Small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Typography */
    .display-1 { font-size: 2.5rem; }
    .display-2 { font-size: 2.25rem; }
    .display-3 { font-size: 2rem; }
    .display-4 { font-size: 1.75rem; }
    .display-5 { font-size: 1.5rem; }
    .display-6 { font-size: 1.25rem; }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    /* Hero Section */
    .hero-section {
        padding: 30px 0;
        text-align: center;
    }
    
    .hero-section h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
    
    /* Cards */
    .card {
        margin: 10px 5px;
        border-radius: 12px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        margin-bottom: 10px;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .btn-group .btn {
        width: auto;
        margin-bottom: 0;
    }
    
    .btn-lg {
        padding: 15px 25px;
        font-size: 1rem;
    }
    
    .btn-sm {
        padding: 8px 15px;
        font-size: 0.8rem;
    }
    
    /* Forms */
    .form-control {
        padding: 12px 16px;
        font-size: 1rem;
    }
    
    .form-control-lg {
        padding: 15px 20px;
        font-size: 1.1rem;
    }
    
    .form-control-sm {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .input-group-text {
        padding: 12px 16px;
    }
    
    /* Tables */
    .table-responsive {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }
    
    /* Navigation */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
    }
    
    /* Sidebar */
    .sidebar {
        min-height: auto;
        position: relative;
    }
    
    .sidebar .nav-link {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    /* Statistics Cards */
    .stat-card {
        margin-bottom: 1rem;
        text-align: center;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    /* Modals */
    .modal-dialog {
        margin: 10px;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
    }
    
    /* Alerts */
    .alert {
        margin: 10px 5px;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.35em 0.5em;
    }
    
    /* Spacing */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .col,
    [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Utilities */
    .text-xs-center { text-align: center; }
    .text-xs-left { text-align: left; }
    .text-xs-right { text-align: right; }
    
    .d-xs-none { display: none; }
    .d-xs-block { display: block; }
    .d-xs-inline { display: inline; }
    .d-xs-inline-block { display: inline-block; }
    .d-xs-flex { display: flex; }
    
    /* Hide complex elements on very small screens */
    .hide-xs {
        display: none !important;
    }
    
    /* Simplify complex layouts */
    .complex-layout {
        flex-direction: column;
    }
    
    /* Touch-friendly elements */
    .touch-target {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Hero Section */
    .hero-section {
        padding: 40px 0;
    }
    
    .hero-section h1 {
        font-size: 2.2rem;
    }
    
    /* Cards */
    .card {
        margin: 15px 10px;
        border-radius: 15px;
    }
    
    /* Buttons */
    .btn {
        width: auto;
        margin-bottom: 5px;
        margin-right: 5px;
    }
    
    /* Forms */
    .form-row .col {
        margin-bottom: 1rem;
    }
    
    /* Tables */
    .table-responsive {
        font-size: 0.9rem;
    }
    
    /* Statistics */
    .stat-card {
        margin-bottom: 1.5rem;
    }
    
    .stat-number {
        font-size: 2.2rem;
    }
    
    /* Sidebar */
    .sidebar {
        min-height: auto;
    }
    
    /* Navigation improvements */
    .navbar-nav {
        flex-direction: row;
        justify-content: center;
    }
    
    .nav-item {
        margin: 0 0.5rem;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Hero Section */
    .hero-section {
        padding: 50px 0;
    }
    
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    /* Cards */
    .card {
        margin-bottom: 20px;
        border-radius: 18px;
    }
    
    /* Statistics */
    .stat-card {
        margin-bottom: 2rem;
    }
    
    .stat-number {
        font-size: 2.5rem;
    }
    
    /* Tables */
    .table-responsive {
        font-size: 0.95rem;
    }
    
    /* Forms */
    .form-control {
        padding: 14px 18px;
    }
    
    /* Sidebar adjustments */
    .sidebar {
        min-height: 100vh;
    }
    
    .sidebar .nav-link {
        padding: 12px 18px;
    }
    
    /* Better spacing */
    .container {
        max-width: 720px;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Hero Section */
    .hero-section {
        padding: 60px 0;
    }
    
    .hero-section h1 {
        font-size: 2.8rem;
    }
    
    /* Cards */
    .card {
        border-radius: 20px;
    }
    
    /* Statistics */
    .stat-number {
        font-size: 2.8rem;
    }
    
    /* Better container width */
    .container {
        max-width: 960px;
    }
    
    /* Sidebar full height */
    .sidebar {
        min-height: 100vh;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    /* Hero Section */
    .hero-section {
        padding: 80px 0;
    }
    
    .hero-section h1 {
        font-size: 3rem;
    }
    
    /* Statistics */
    .stat-number {
        font-size: 3rem;
    }
    
    /* Better spacing for large screens */
    .container {
        max-width: 1140px;
    }
    
    /* Enhanced hover effects */
    .card:hover {
        transform: translateY(-8px) scale(1.02);
    }
    
    .btn:hover {
        transform: translateY(-3px);
    }
}

/* Extra extra large devices (larger desktops, 1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-section h1 {
        font-size: 3.5rem;
    }
    
    .stat-number {
        font-size: 3.5rem;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section {
        padding: 20px 0;
    }
    
    .hero-section h1 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }
    
    .hero-section p {
        margin-bottom: 0.5rem;
    }
    
    .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .sidebar {
        min-height: auto;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders and shadows */
    .card {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }
    
    .btn {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    /* Better text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Dark mode responsive adjustments */
@media (prefers-color-scheme: dark) {
    @media (max-width: 767.98px) {
        .card {
            background: rgba(45, 55, 72, 0.95);
            border-color: rgba(255, 255, 255, 0.1);
        }
        
        .form-control {
            background: rgba(74, 85, 104, 0.9);
            border-color: rgba(255, 255, 255, 0.2);
            color: #e2e8f0;
        }
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .card,
    .btn,
    .form-control,
    .alert {
        transition: none !important;
        animation: none !important;
    }
    
    .floating-shapes {
        display: none !important;
    }
    
    .hero-section::before {
        display: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
        background: #fff;
    }
    
    .btn {
        border: 2px solid #000;
    }
    
    .form-control {
        border: 2px solid #000;
    }
    
    .alert {
        border: 2px solid #000;
    }
}

/* Print responsive adjustments */
@media print {
    @page {
        size: A4;
        margin: 1.5cm;
    }
    
    .container {
        width: 100% !important;
        max-width: none !important;
    }
    
    .row {
        display: block !important;
    }
    
    .col,
    [class*="col-"] {
        width: 100% !important;
        display: block !important;
        margin-bottom: 1rem !important;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: no-preference) {
    .smooth-scroll {
        scroll-behavior: smooth;
    }
}

/* Focus improvements for keyboard navigation */
@media (any-hover: none) {
    .btn:focus,
    .form-control:focus,
    .nav-link:focus {
        outline: 3px solid #667eea;
        outline-offset: 2px;
    }
}

/* Touch device optimizations */
@media (any-hover: none) and (any-pointer: coarse) {
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .form-control {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .nav-link {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    /* Larger touch targets */
    .touch-target {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}