/**
 * Prompt Builder - Responsive Styles
 * Handles responsive design for different screen sizes
 */

/* Extra Small Devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    .app-header {
        padding: 0.5rem 0;
    }
    
    .logo h1 {
        font-size: 1.2rem;
    }
    
    .step-label {
        display: none;
    }
    
    .step-number {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .form-section {
        padding: 1rem;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .tech-categories {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .tech-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Better spacing for mobile UI elements */
    .feature-item {
        margin-bottom: 10px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .feature-input {
        margin-bottom: 8px;
        padding: 8px;
        width: 100%;
    }
    
    .feature-actions {
        justify-content: flex-end;
    }
    
    .feature-actions button {
        padding: 8px 12px;
        margin-left: 5px;
    }
    
    .complexity-value {
        margin-bottom: 1rem;
    }
    
    #complexity-value {
        font-size: 3.5rem;
    }
    
    .complexity-label {
        font-size: 1.2rem;
    }
    
    .complexity-slider-container {
        padding: 1rem;
    }
    
    input[type="range"] {
        height: 30px;
        -webkit-appearance: none;
        margin: 10px 0;
        width: 100%;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        height: 25px;
        width: 25px;
        border-radius: 50%;
        background: var(--primary-color);
        cursor: pointer;
        -webkit-appearance: none;
        margin-top: -8px;
    }
    
    input[type="range"]::-moz-range-thumb {
        height: 25px;
        width: 25px;
        border-radius: 50%;
        background: var(--primary-color);
        cursor: pointer;
    }
    
    input[type="range"]::-ms-thumb {
        height: 25px;
        width: 25px;
        border-radius: 50%;
        background: var(--primary-color);
        cursor: pointer;
    }
    
    .advanced-options {
        grid-template-columns: 1fr;
    }
    
    /* Improved output display for mobile */
    .output-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .output-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }
    
    .output-controls button {
        flex: 1;
        min-width: calc(50% - 0.5rem);
        text-align: center;
        padding: 10px 15px;
    }
    
    /* Output text display */
    .output-text {
        font-size: 14px;
        line-height: 1.5;
        word-break: break-word;
    }
    
    /* Footer adjustments */
    .app-footer {
        text-align: center;
        padding: 15px 0;
    }
    
    .app-footer .text-end {
        text-align: center !important;
        margin-top: 0.5rem;
    }
    
    /* Improved navigation */
    .section-footer button {
        padding: 12px 20px;
        font-size: 16px;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .logo h1 {
        font-size: 1.3rem;
    }
    
    .step-label {
        font-size: 0.7rem;
    }
    
    .tech-categories {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .tech-options {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .advanced-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .output-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .tech-categories {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tech-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sidebar {
        margin-top: 2rem;
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .tech-categories {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container-fluid {
        max-width: 1400px;
    }
}

/* Responsive Adjustments for All Devices */

/* Mobile Navigation */
@media (max-width: 767.98px) {
    .sidebar {
        position: static;
        margin-top: 2rem;
    }
    
    .section-footer {
        flex-direction: column;
        gap: 1rem;
    }
    
    .section-footer button {
        width: 100%;
    }
    
    .features-list-container,
    .suggestions-container {
        margin-bottom: 1.5rem;
    }
    
    .features-list,
    .suggestions-list {
        min-height: 200px;
    }
    
    /* Improved suggestions for mobile */
    .suggestion-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
    }
    
    .suggestion-item span {
        flex: 1;
        margin-right: 10px;
    }
    
    .add-suggestion {
        padding: 8px 12px;
        background-color: var(--primary-color);
        color: white;
        border-radius: 4px;
        font-size: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Tablet and Mobile Adjustments */
@media (max-width: 991.98px) {
    .header-actions {
        margin-top: 1rem;
        justify-content: center;
    }
    
    .progress-container {
        margin-top: 1rem;
    }
}

/* Print Styles */
@media print {
    .app-header,
    .app-footer,
    .sidebar,
    .section-footer,
    .form-section:not(.active) {
        display: none !important;
    }
    
    .form-container,
    .output-container {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
    
    .output-controls {
        display: none;
    }
    
    .output-content {
        min-height: auto;
    }
    
    .output-text {
        font-size: 12pt;
        color: black;
    }
    
    body {
        background-color: white;
        color: black;
    }
}

/* Responsive Form Elements */
@media (max-width: 767.98px) {
    .form-control,
    .form-select,
    .btn {
        font-size: 0.9rem;
        padding: 0.375rem 0.5rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
}

/* Responsive Modals */
@media (max-width: 575.98px) {
    .modal-body {
        padding: 1rem;
    }
    
    .tutorial-slide {
        padding: 0.5rem;
    }
}

/* Responsive Toast Messages */
@media (max-width: 575.98px) {
    .toast-container {
        width: 100%;
        padding: 0.5rem;
    }
    
    .toast {
        width: 100%;
    }
}

/* Accessibility - Larger Text Option */
.large-text {
    font-size: 1.2em;
}

.large-text .form-control,
.large-text .form-select,
.large-text .btn {
    font-size: 1.1em;
}

.large-text .tech-option label span {
    font-size: 1.1em;
}

.large-text .step-label {
    font-size: 1em;
}

/* Touch-friendly adjustments for mobile */
@media (pointer: coarse) {
    .tech-option label,
    .advanced-option,
    .btn,
    .form-control,
    .form-select {
        min-height: 44px; /* Minimum touch target size */
    }
    
    .tech-option label {
        padding: 1.5rem;
    }
    
    .feature-actions button,
    .prompt-actions button {
        padding: 0.75rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    input[type="checkbox"],
    input[type="radio"] {
        transform: scale(1.3);
        margin-right: 10px;
    }
    
    /* Improved touch areas for all interactive elements */
    button, 
    .btn,
    a.list-group-item,
    select,
    input[type="text"],
    textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Fixed positioned elements for mobile */
    #add-feature-btn {
        padding: 10px 15px;
        font-size: 16px;
    }
    
    /* Saved prompts touch improvements */
    .saved-prompts-container .list-group-item {
        padding: 15px;
    }
    
    .prompt-actions button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Orientation-specific styles */
@media (orientation: landscape) and (max-height: 500px) {
    .app-header {
        position: static;
    }
    
    .sidebar {
        position: static;
    }
    
    .complexity-slider-container {
        max-width: 100%;
    }
    
    .complexity-value {
        margin-bottom: 1rem;
    }
    
    #complexity-value {
        font-size: 2.5rem;
    }
}

/* High-resolution screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize images for high-resolution displays if needed */
    .tutorial-image img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Dark mode media query - for automatic dark mode based on system preference */
@media (prefers-color-scheme: dark) {
    body.auto-theme {
        --bg-primary: #212529;
        --bg-secondary: #343a40;
        --bg-tertiary: #495057;
        --text-primary: #f8f9fa;
        --text-secondary: #e9ecef;
        --text-muted: #adb5bd;
        --border-color: #495057;
        --shadow-color: rgba(0, 0, 0, 0.3);
        --input-bg: #343a40;
        --input-border: #495057;
        --input-text: #f8f9fa;
        --card-bg: #343a40;
        --toast-bg: #343a40;
        --toast-border: #495057;
        --modal-bg: #343a40;
        --modal-border: #495057;
    }
}
