/* ===== Tablet Layout (768px) ===== */
@media (max-width: 768px) {
    .header-container {
        padding: 1rem;
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    .header-controls {
        gap: 0.5rem;
    }

    .language-toggle,
    .theme-toggle {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .main-container {
        padding: 1.5rem 1rem;
    }

    .hero-section h2 {
        font-size: 1.75rem;
    }

    .hero-section p {
        font-size: 1rem;
    }

    .budget-section {
        padding: 1.5rem;
    }

    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
        border: none;
        padding: 0;
    }

    .results-header h2 {
        font-size: 1.5rem;
    }

    .results-header button {
        align-self: stretch;
    }

    .build-specs {
        grid-template-columns: repeat(2, 1fr);
    }

    .alternatives-container {
        grid-template-columns: 1fr;
    }

    .mode-tabs {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .mode-tab {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .picker-header {
        flex-direction: column;
        gap: 1rem;
    }

    .picker-title-group {
        flex: initial;
        min-width: initial;
    }

    .picker-actions {
        width: 100%;
    }

    .btn-save,
    .btn-share {
        flex: 1;
        min-width: 120px;
    }

    .component-selector {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .component-group {
        padding: 1.25rem;
    }

    .picker-summary {
        padding: 1.5rem;
    }

    .summary-content {
        grid-template-columns: 1fr;
    }

    .selected-build-preview {
        grid-template-columns: 1fr;
    }

    .modal-header,
    .modal-footer {
        padding: 1.5rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 1rem;
    }

    .btn-primary,
    .btn-secondary,
    .submit-btn,
    .reset-btn {
        width: 100%;
    }

    .btn-save,
    .btn-share,
    .btn-reset-picker {
        width: 100%;
    }

    #prevBtn {
        width: 100% !important;
    }

    #nextBtn {
        width: 100%;
    }
}

/* ===== Mobile Layout (480px) ===== */
@media (max-width: 480px) {
    .header-container {
        padding: 0.75rem;
    }

    .logo h1 {
        font-size: 1rem;
    }

    .language-toggle,
    .theme-toggle {
        padding: 0.5rem 0.5rem;
        font-size: 0.7rem;
        min-width: auto;
    }

    .theme-icon {
        font-size: 1rem;
    }

    .main-container {
        padding: 1rem 0.75rem;
        min-height: calc(100vh - 150px);
    }

    .hero-section {
        margin-bottom: 2rem;
    }

    .hero-section h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .hero-section p {
        font-size: 0.95rem;
    }

    .budget-section {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: var(--radius-md);
    }

    .input-wrapper {
        margin-bottom: 1.5rem;
    }

    #budgetInput {
        padding: 0.6rem 0.8rem 0.6rem 2.2rem;
        font-size: 0.95rem;
    }

    .currency {
        padding: 0 0.6rem;
    }

    .slider-labels {
        font-size: 0.75rem;
    }

    .submit-btn {
        padding: 0.65rem 1.5rem;
        font-size: 0.95rem;
        margin-top: 0.75rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .modal-header,
    .modal-footer {
        padding: 1rem;
    }

    .question-number {
        padding: 0.4rem 0.8rem;
        margin-bottom: 1rem;
        font-size: 0.875rem;
    }

    #questionText {
        font-size: 1.1rem;
        line-height: 1.4;
    }

    .options-container {
        gap: 0.75rem;
    }

    .option-button {
        padding: 0.8rem;
        font-size: 0.95rem;
        text-align: right;
        border-radius: var(--radius-md);
    }

    .build-card {
        padding: 1.5rem;
        border-radius: var(--radius-md);
    }

    .build-name {
        font-size: 1.25rem;
    }

    .build-price {
        font-size: 1.5rem;
    }

    .build-specs {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .spec-item {
        padding: 0.75rem;
    }

    .spec-label {
        font-size: 0.75rem;
    }

    .spec-value {
        font-size: 0.95rem;
    }

    .build-performance {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .performance-label {
        font-size: 0.75rem;
    }

    .performance-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .results-header h2 {
        font-size: 1.3rem;
    }

    .alternatives-container {
        gap: 1rem;
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .footer {
        padding: 1.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Modal on Mobile */
    .modal-overlay {
        align-items: flex-start;
        padding-top: 2rem;
    }

    .modal-content {
        width: 98%;
        max-height: 85vh;
        border-radius: var(--radius-lg);
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .btn-primary,
    .btn-secondary,
    .submit-btn,
    .reset-btn,
    #prevBtn,
    #nextBtn {
        width: 100%;
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
    }

    .mode-tabs {
        padding: 0.5rem;
        gap: 0.25rem;
        flex-direction: column;
    }

    .mode-tab {
        padding: 0.5rem;
        font-size: 0.85rem;
        width: 100%;
    }

    .picker-container {
        padding: 0 1rem;
    }

    .picker-header {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .picker-title {
        font-size: 1.5rem;
    }

    .picker-actions {
        width: 100%;
        flex-direction: column;
    }

    .btn-save,
    .btn-share,
    .btn-reset-picker {
        width: 100%;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .component-selector {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .component-group {
        padding: 1rem;
    }

    .component-label {
        font-size: 0.85rem;
    }

    .component-select {
        padding: 0.6rem 0.75rem;
        font-size: 0.95rem;
    }

    .picker-summary {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .summary-header {
        font-size: 1rem;
    }

    .summary-content {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .summary-row {
        padding: 0.75rem;
    }

    .summary-label {
        font-size: 0.85rem;
    }

    .summary-value {
        font-size: 1.1rem;
    }

    .selected-build-preview {
        grid-template-columns: 1fr;
    }
}

/* ===== Small Mobile (360px) ===== */
@media (max-width: 360px) {
    .hero-section h2 {
        font-size: 1.25rem;
    }

    .logo h1 {
        font-size: 0.9rem;
    }

    .header-container {
        padding: 0.5rem;
    }

    .main-container {
        padding: 0.75rem;
    }

    .budget-section {
        padding: 0.75rem;
    }

    .modal-header,
    .modal-footer {
        padding: 0.75rem;
    }

    #questionText {
        font-size: 1rem;
    }

    .language-toggle,
    .theme-toggle {
        padding: 0.4rem;
        font-size: 0.6rem;
    }

    .build-card {
        padding: 1rem;
    }

    .spec-item {
        padding: 0.6rem;
    }
}

/* ===== Landscape Orientation (Mobile) ===== */
@media (max-height: 500px) and (max-width: 768px) {
    .main-container {
        padding: 1rem 0.75rem;
    }

    .hero-section h2 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .hero-section p {
        display: none;
    }

    .budget-section {
        padding: 1rem;
    }

    .input-wrapper,
    .slider-wrapper {
        margin-bottom: 0.75rem;
    }

    .submit-btn {
        margin-top: 0.5rem;
    }

    .modal-overlay {
        padding-top: 0.5rem;
    }

    .modal-content {
        max-height: 95vh;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    .results-section {
        margin-top: 0.5rem;
    }
}

/* ===== High Resolution Displays ===== */
@media (min-width: 1440px) {
    .main-container {
        max-width: 1400px;
    }

    .hero-section h2 {
        font-size: 3rem;
    }

    .budget-section {
        padding: 3rem;
    }

    .build-card {
        padding: 2.5rem;
    }

    .spec-item {
        padding: 1.25rem;
    }
}

/* ===== Print Styles ===== */
@media print {
    .header-controls,
    .submit-btn,
    .reset-btn,
    #prevBtn,
    #nextBtn {
        display: none;
    }

    .build-card {
        page-break-inside: avoid;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: more) {
    :root {
        --border-color: #ccc;
    }

    body.dark-mode {
        --border-color: #555;
    }

    button,
    input {
        border-width: 2px;
    }
}

/* Image responsive styles */
@media (max-width: 768px) {
    .spec-image-container {
        height: 120px;
    }

    .spec-image {
        max-height: 120px;
    }
}

@media (max-width: 480px) {
    .spec-image-container {
        height: 100px;
        margin-bottom: 0.5rem;
    }

    .spec-image {
        max-height: 100px;
    }
}
