/* Mobile Responsive Styles */

@media (max-width: 768px) {
    /* General adjustments */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Hero section */
    .hero-section {
        padding: 40px 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    /* Terminal window */
    .terminal-window.full-size {
        height: 300px;
    }
    
    .terminal-body {
        height: 250px;
        font-size: 0.9rem;
    }
    
    /* Cards */
    .card-body {
        padding: 1rem;
    }
    
    /* Navigation */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* Process steps */
    .process-step {
        flex-direction: column;
        text-align: center;
    }
    
    .step-number {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .process-step:not(:last-child)::after {
        left: 50%;
        top: 40px;
        bottom: -30px;
        transform: translateX(-50%);
    }
    
    /* Tables */
    .table-responsive {
        font-size: 0.9rem;
    }
    
    /* Forms */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Buttons */
    .btn {
        white-space: normal;
    }
    
    /* Dashboard stats */
    .stat-card .fw-bold {
        font-size: 1.5rem;
    }
    
    /* Learning modules */
    .command-card {
        margin-bottom: 1rem;
    }
    
    /* CTF challenges */
    .challenge-card .card-body {
        padding: 1rem;
    }
    
    /* Practice console */
    .terminal-input {
        flex-direction: column;
        gap: 10px;
    }
    
    .command-input {
        width: 100%;
    }
    
    /* Profile page */
    .profile-stats .col-4 {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    /* Extra small devices */
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
    
    /* Cards */
    .card {
        margin-bottom: 1rem;
    }
    
    /* Tables */
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    /* Modal */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    /* Navigation dropdown */
    .dropdown-menu {
        position: static;
        float: none;
        width: 100%;
    }
    
    /* Progress bars */
    .progress {
        height: 6px;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }
    
    .feature-card:hover {
        transform: none;
    }
    
    .challenge-card:hover {
        transform: none;
    }
    
    /* Increase touch targets */
    .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .form-check-label,
    .nav-link {
        padding: 10px 15px;
    }
    
    /* Better form controls */
    select.form-control,
    input.form-control {
        min-height: 44px;
    }
}

/* Landscape orientation fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding: 20px 0;
    }
    
    .terminal-window.full-size {
        height: 200px;
    }
    
    .terminal-body {
        height: 150px;
    }
    
    .modal.show .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .terminal-window {
        border-radius: 12px;
    }
    
    .card {
        border-radius: 12px;
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .terminal-window,
    .feature-card,
    .hero-section {
        display: none !important;
    }
    
    .container {
        max-width: none;
    }
    
    .card {
        border: 1px solid #000 !important;
        break-inside: avoid;
    }
    
    a {
        text-decoration: underline !important;
        color: #000 !important;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .progress-bar {
        transition: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bs-body-bg: #1a1a1a;
        --bs-body-color: #ffffff;
    }
}

/* Focus styles for accessibility */
@media (prefers-reduced-motion: no-preference) {
    .btn:focus,
    .form-control:focus,
    .form-check-input:focus {
        outline: 2px solid #0d6efd;
        outline-offset: 2px;
    }
}