/* Mobile First Responsive Design */

/* Base Mobile Styles (320px - 767px) */
* {
    box-sizing: border-box;
}

/* Typography scaling for mobile */
@media (max-width: 767px) {
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
}

/* Navigation responsive */
@media (max-width: 767px) {
    .navbar {
        padding: 0.5rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .nav-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.9rem;
    }
    
    /* Stack navigation items vertically on small screens */
    .navbar-nav {
        flex-direction: column;
        text-align: center;
    }
}

/* Hero section responsive */
@media (max-width: 767px) {
    .hero-section {
        padding: 2rem 1rem;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
}

/* Exam cards responsive */
@media (max-width: 767px) {
    .exam-card {
        margin-bottom: 1rem;
    }
    
    .exam-card .card-body {
        padding: 1rem;
    }
    
    .exam-card h5 {
        font-size: 1.1rem;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

/* Typing test area responsive */
@media (max-width: 767px) {
    /* Passage container */
    .passage-container {
        font-size: 14px;
        padding: 1rem;
        max-height: 200px;
        margin-bottom: 1rem;
    }
    
    /* Hide Hindi font selector on mobile to save space */
    #fontSelector {
        font-size: 0.875rem;
    }
    
    /* Typing input area */
    .typing-box, #userInput {
        font-size: 14px;
        min-height: 100px;
        padding: 0.75rem;
    }
    
    /* Stats box - make it collapsible on mobile */
    .stats-box {
        margin-top: 1rem;
        padding: 1rem;
        font-size: 0.875rem;
    }
    
    .stats-box h5 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .stats-box p {
        margin-bottom: 0.25rem;
        font-size: 0.875rem;
    }
}

/* Result page responsive */
@media (max-width: 767px) {
    .result-container {
        padding: 1rem;
    }
    
    .result-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .result-stat {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
}

/* Feedback form responsive */
@media (max-width: 767px) {
    .feedback-form {
        padding: 1rem;
    }
    
    .form-control {
        font-size: 14px;
    }
    
    textarea.form-control {
        min-height: 80px;
    }
}

/* Table responsive */
@media (max-width: 767px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table td, .table th {
        padding: 0.5rem;
    }
}

/* Tablet Styles (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        max-width: 750px;
    }
    
    .passage-container {
        font-size: 16px;
        max-height: 250px;
    }
    
    .typing-box {
        font-size: 16px;
        min-height: 120px;
    }
    
    /* Two column layout for exam cards */
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Desktop Styles (1024px+) */
@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
    }
    
    .passage-container {
        font-size: 18px;
        max-height: 300px;
    }
    
    .typing-box {
        font-size: 16px;
        min-height: 150px;
    }
}

/* Utility classes for responsive spacing */
@media (max-width: 767px) {
    .mt-sm-2 { margin-top: 0.5rem !important; }
    .mt-sm-3 { margin-top: 1rem !important; }
    .mb-sm-2 { margin-bottom: 0.5rem !important; }
    .mb-sm-3 { margin-bottom: 1rem !important; }
    .p-sm-2 { padding: 0.5rem !important; }
    .p-sm-3 { padding: 1rem !important; }
}

/* Hide elements on mobile */
@media (max-width: 575px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show elements only on mobile */
@media (min-width: 576px) {
    .show-mobile {
        display: none !important;
    }
}

/* Responsive timer display */
@media (max-width: 767px) {
    #timer {
        font-size: 1.25rem;
        font-weight: bold;
    }
}

/* Button group responsive */
@media (max-width: 767px) {
    .btn-group-vertical {
        width: 100%;
    }
    
    .btn-group-vertical .btn {
        text-align: left;
    }
}

/* Footer responsive */
@media (max-width: 767px) {
    footer {
        text-align: center;
        padding: 1rem;
    }
    
    footer .row > div {
        margin-bottom: 1rem;
    }
}

/* Landscape mode adjustments for mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .passage-container {
        max-height: 150px;
    }
    
    .typing-box {
        min-height: 80px;
    }
    
    .hero-section {
        padding: 1rem;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .passage-container {
        max-height: none;
        border: 1px solid #000;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Add any retina-specific styles here */
}

/* Accessibility - Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}