/* Responsive Design for NASA Space Explorer */

/* Large Desktop (1200px and up) */
@media (min-width: 1200px) {
    .hero-title {
        font-size: 4rem;
    }
    
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .mars-photos {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* Desktop (992px to 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .nav-container {
        padding: 1rem 1.5rem;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .section {
        padding: 3rem 1.5rem;
    }
}

/* Tablet (768px to 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .nav-menu {
        gap: 1rem;
    }
    
    .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .feature-card {
        padding: 1.5rem;
    }
    
    .apod-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .apod-image-container {
        order: -1;
    }
    
    .mars-controls {
        gap: 0.8rem;
        flex-direction: column;
        align-items: center;
    }
    
    .mars-controls select {
        font-size: 0.9rem;
        padding: 0.7rem 1rem;
        min-width: 200px;
        max-width: 300px;
        width: 100%;
    }
    
    .mars-controls .btn-primary {
        width: 100%;
        max-width: 300px;
    }
    
    .mars-photos {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .exoplanet-controls {
        flex-direction: column;
        align-items: center;
    }
    
    #planet-search {
        min-width: 100%;
        max-width: 400px;
    }
    
    .quiz-progress {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .progress-bar {
        margin: 0;
        order: -1;
    }
    
    .passport-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Large (576px to 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    .nav-container {
        padding: 0.8rem 1rem;
    }
    
    .logo-title {
        font-size: 1.3rem;
    }
    
    .logo-subtitle {
        font-size: 0.6rem;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: rgba(0, 0, 0, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 2rem 0;
        transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        border-top: 1px solid var(--border-color);
        gap: 0.5rem;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-item {
        width: 90%;
        max-width: 300px;
    }
    
    .nav-link {
        width: 100%;
        justify-content: center;
        padding: 1.2rem 2rem;
        font-size: 1rem;
        border-radius: 15px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 0.5rem;
    }
    
    .nav-link:hover {
        background: rgba(255, 215, 0, 0.1);
        border-color: rgba(255, 215, 0, 0.3);
        transform: scale(1.02);
    }
    
    .nav-link.active {
        background: var(--gradient-space);
        border-color: var(--accent-color);
    }
    
    .nav-icon {
        font-size: 1.3rem;
        margin-right: 0.8rem;
    }
    
    .nav-text {
        font-size: 1rem;
        font-weight: 600;
    }
    
    .hamburger {
        display: flex;
    }
    
    /* Mobile menu overlay */
    .nav-menu.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
    
    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    .hero-title {
        font-size: 2.2rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 250px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .section {
        padding: 2rem 1rem;
    }
    
    .section-header h2 {
        font-size: 2rem;
    }
    
    .apod-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .apod-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .apod-controls .btn-primary,
    .apod-controls .btn-secondary {
        width: 100%;
    }
    
    .mars-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .mars-controls select,
    .mars-controls .btn-primary {
        width: 100%;
        max-width: 300px;
    }
    
    .mars-photos {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .exoplanet-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .exoplanet-controls input,
    .exoplanet-controls button {
        width: 100%;
        max-width: 300px;
    }
    
    .exoplanet-stats {
        grid-template-columns: 1fr;
    }
    
    .quiz-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .quiz-controls .btn-primary,
    .quiz-controls .btn-secondary {
        width: 100%;
    }
    
    .quiz-actions {
        flex-direction: column;
    }
    
    .quiz-actions .btn-primary,
    .quiz-actions .btn-secondary {
        width: 100%;
        max-width: 250px;
    }
    
    .passport-details {
        grid-template-columns: 1fr;
    }
    
    .passport-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .passport-actions .btn-primary,
    .passport-actions .btn-secondary {
        width: 100%;
        max-width: 250px;
    }
    
    .planet-orbit {
        width: 150px;
        height: 150px;
    }
    
    .planet {
        width: 45px;
        height: 45px;
    }
}

/* Mobile Small (up to 575px) */
@media (max-width: 575px) {
    .nav-container {
        padding: 0.8rem;
    }
    
    .logo h1 {
        font-size: 1.1rem;
    }
    
    .hero-title {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
    
    .section {
        padding: 1.5rem 0.8rem;
    }
    
    .section-header {
        margin-bottom: 2rem;
    }
    
    .section-header h2 {
        font-size: 1.6rem;
    }
    
    .section-header p {
        font-size: 1rem;
    }
    
    .feature-card {
        padding: 1.2rem;
    }
    
    .feature-icon {
        font-size: 2.5rem;
    }
    
    .feature-card h3 {
        font-size: 1.1rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .apod-info h3 {
        font-size: 1.2rem;
    }
    
    .mars-photos {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
    }
    
    .mars-photo {
        border-radius: 8px;
    }
    
    .mars-photo img {
        height: 120px;
    }
    
    .mars-photo-info {
        padding: 0.8rem;
    }
    
    .mars-photo-info h4 {
        font-size: 0.9rem;
    }
    
    .mars-photo-info p {
        font-size: 0.8rem;
    }
    
    .exoplanet-card {
        padding: 1rem;
    }
    
    .quiz-welcome,
    .quiz-game,
    .quiz-results {
        padding: 1.5rem 1rem;
    }
    
    .difficulty-btn {
        display: block;
        width: 100%;
        margin: 0.5rem 0;
    }
    
    .question-container {
        padding: 1.5rem 1rem;
    }
    
    #question-text {
        font-size: 1rem;
    }
    
    .answer-option {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .adopt-welcome,
    .planet-passport {
        padding: 1.5rem 1rem;
    }
    
    .planet-orbit {
        width: 120px;
        height: 120px;
    }
    
    .planet {
        width: 35px;
        height: 35px;
    }
    
    .detail-item {
        padding: 0.8rem;
    }
    
    .detail-label {
        font-size: 0.9rem;
    }
}

/* Extra Small Mobile (up to 400px) */
@media (max-width: 400px) {
    .logo h1 {
        font-size: 1rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
    }
    
    .section {
        padding: 1rem 0.5rem;
    }
    
    .section-header h2 {
        font-size: 1.4rem;
    }
    
    .feature-card {
        padding: 1rem;
    }
    
    .feature-icon {
        font-size: 2rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 0.6rem 1.2rem;
        font-size: 0.8rem;
    }
    
    .mars-photos {
        grid-template-columns: 1fr;
    }
    
    .mars-photo img {
        height: 150px;
    }
    
    .quiz-welcome,
    .quiz-game,
    .quiz-results,
    .adopt-welcome,
    .planet-passport {
        padding: 1rem 0.8rem;
    }
    
    .planet-orbit {
        width: 100px;
        height: 100px;
    }
    
    .planet {
        width: 30px;
        height: 30px;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-container {
        padding: 2rem 0;
    }
    
    .section {
        padding: 2rem 1rem;
    }
    
    .nav-menu {
        height: calc(100vh - 60px);
        top: 60px;
    }
    
    .main-header {
        height: 60px;
    }
    
    .nav-container {
        padding: 0.5rem 1rem;
    }
    
    .main-content {
        margin-top: 60px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .feature-icon {
        transform: scale(0.9);
    }
    
    .btn-primary,
    .btn-secondary {
        font-weight: 500;
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
    :root {
        --background-card: rgba(255, 255, 255, 0.08);
        --border-color: rgba(255, 255, 255, 0.15);
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .planet-orbit,
    .planet {
        animation: none;
    }
}

/* Print styles */
@media print {
    #starfield,
    .main-header,
    .btn-primary,
    .btn-secondary,
    .hamburger {
        display: none !important;
    }
    
    .main-content {
        margin-top: 0;
    }
    
    .section {
        display: block !important;
        page-break-inside: avoid;
        padding: 1rem 0;
    }
    
    .feature-card,
    .mars-photo,
    .exoplanet-card {
        break-inside: avoid;
    }
}
