/* Responsive Styles for Jupiter Image Tools */

/* ===== Media Queries ===== */

/* General Responsive Styles */
@media (max-width: 1200px) {
    .container {
        width: 95%;
    }
    
    .three-column-layout {
        gap: var(--spacing-md);
    }
}

/* Medium Devices (up to 991px) */
@media (max-width: 991px) {
    :root {
        --left-column-width: 150px;
        --right-column-width: 250px;
    }

    /* Three Column Layout Adjustments */
    .three-column-layout {
        flex-direction: column;
    }
    
    .left-column, .right-column {
        width: 100%;
    }
    
    /* Convert left column to horizontal layout */
    .left-column {
        display: flex;
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
    }
    
    .affiliate-image-container {
        flex: 1;
        margin-bottom: 0;
    }
    
    /* Switch editor section to vertical on mobile */
    .editor-section {
        flex-direction: column;
    }
    
    .image-preview-container,
    .controls-container {
        width: 100%;
        max-width: 100%;
        flex: none;
    }
    
    .controls-container {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
    
    /* Fix for control row containing resize/crop and rotate sections */
    .control-row {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .control-group-wide, 
    .control-group-narrow {
        flex: none;
        width: 100%;
        padding: var(--spacing-md);
    }
    
    .control-group-narrow {
        border-left: none;
        border-top: 1px solid #eaeaea;
        padding-top: var(--spacing-lg);
        margin-top: var(--spacing-sm);
    }
    
    .newsletter-container {
        position: static;
    }
    
    /* Navigation menu changes */
    .menu-toggle {
        display: block;
        width: 40px;
        height: 40px;
        position: relative;
        z-index: 101;
    }
    
    .hamburger-icon, 
    .hamburger-icon::before, 
    .hamburger-icon::after {
        display: block;
        position: absolute;
        height: 3px;
        width: 30px;
        background-color: var(--white);
        border-radius: 3px;
        transition: transform var(--transition-medium);
    }
    
    .hamburger-icon {
        top: 50%;
        transform: translateY(-50%);
    }
    
    .hamburger-icon::before {
        content: '';
        top: -10px;
    }
    
    .hamburger-icon::after {
        content: '';
        bottom: -10px;
    }
    
    /* Hamburger icon animation for open state */
    .menu-toggle.active .hamburger-icon {
        background-color: transparent;
    }
    
    .menu-toggle.active .hamburger-icon::before {
        transform: rotate(45deg) translate(7px, 7px);
    }
    
    .menu-toggle.active .hamburger-icon::after {
        transform: rotate(-45deg) translate(7px, -7px);
    }
    
    .nav-list {
        position: fixed;
        top: 0;
        right: -100%;
        width: 250px;
        height: 100vh;
        background: var(--primary-gradient);
        flex-direction: column;
        padding: var(--spacing-xxl) var(--spacing-lg);
        gap: var(--spacing-md);
        transition: right var(--transition-medium);
        z-index: 100;
    }
    
    .nav-list.active {
        right: 0;
    }
    
    /* Editor section adjustments */
    .controls-container {
        gap: var(--spacing-md);
    }
    
    .control-group {
        padding: var(--spacing-md);
    }
    
    .action-buttons {
        flex-wrap: wrap;
    }
    
    .action-buttons .btn {
        flex: 1;
        min-width: 120px;
    }
    
    #copyBtn, #downloadBtn {
        min-width: 120px;
    }
    
    /* Footer adjustments */
    .footer-info {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-links {
        justify-content: center;
    }
    
    /* Mobile order classes - applied via JavaScript */
    .mobile-order-1 {
        order: 1 !important;
    }
    
    .mobile-order-2 {
        order: 2 !important;
    }
    
    .mobile-order-3 {
        order: 3 !important;
    }
}

/* Small Tablets and Large Phones (up to 767px) */
@media (max-width: 767px) {
    :root {
        --spacing-md: 0.75rem;
        --spacing-lg: 1rem;
    }
    
    .main-container {
        padding: var(--spacing-lg);
    }
    
    .image-preview {
        max-height: 400px;
    }
    
    /* Further adjust left column on smaller screens */
    .left-column {
        flex-direction: column;
    }
    
    .affiliate-image-container {
        margin-bottom: var(--spacing-md);
    }
    
    /* Improve responsive layout for custom size inputs */
    .dimension-inputs {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .dimension-inputs input {
        flex: 1;
        min-width: 80px;
    }
    
    /* Adjust percentage reduction controls */
    .percentage-reduction {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .percentage-input {
        width: 100%;
    }
    
    /* Add visual separation between editor and sidebar content */
    .left-column,
    .right-column {
        border-top: 1px solid #eee;
        padding-top: var(--spacing-lg);
        margin-top: var(--spacing-lg);
    }
    
    /* Adjust animated arrows for small screens */
    .animated-arrow-container {
        left: 0px;
        width: 45px;
        height: 45px;
    }
    
    .animated-arrow {
        width: 28px;
        height: 10px;
    }
    
    .arrow-head {
        top: -9px;
        right: -7px;
        border-left: 15px solid #ff5e62;
        border-top: 14px solid transparent;
        border-bottom: 14px solid transparent;
    }
}

/* Small Mobile Devices (up to 575px) */
@media (max-width: 575px) {
    :root {
        --spacing-xl: 1.5rem;
        --spacing-xxl: 2rem;
    }
    
    .app-name {
        font-size: var(--font-size-lg);
    }
    
    .logo {
        height: 30px;
    }
    
    .upload-area {
        padding: var(--spacing-lg);
    }
    
    .image-preview {
        max-height: 350px;
    }
    
    .image-preview img {
        max-height: 350px;
    }
    
    .control-group {
        padding: var(--spacing-sm);
    }
    
    /* Specific improvements for smaller mobile screens */
    .control-title {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .preset-select {
        width: 100%;
        max-width: none;
    }
    
    .custom-size {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .rotation-buttons.side-by-side {
        justify-content: center;
        gap: 20px;
    }
    
    .rotation-buttons .btn {
        min-width: 60px;
        min-height: 60px;
    }
    
    /* Make buttons larger and more tappable on mobile */
    #applyCustomSize, #applyPercentage, #applyQuality, .action-buttons .btn {
        padding: 12px 10px;
        min-height: 48px;
    }
    
    /* Adjust animated arrows for small screens */
    .animated-arrow-container {
        left: 5px;
        width: 40px;
        height: 40px;
    }
    
    .animated-arrow {
        width: 25px;
        height: 10px;
    }
    
    .arrow-head {
        top: -8px;
        right: -6px;
        border-left: 14px solid #ff5e62;
        border-top: 13px solid transparent;
        border-bottom: 13px solid transparent;
    }
    
    /* Improve form spacing on mobile */
    .form-group {
        margin-bottom: var(--spacing-md);
    }
    
    .newsletter-container {
        padding: var(--spacing-md);
    }
    
    /* Feedback FAB - smaller on mobile */
    .feedback-fab {
        padding: 10px 14px;
        bottom: 15px;
        right: 15px;
    }
    
    .feedback-fab span {
        font-size: 0.85rem;
    }
    
    /* Sticky action bar adjustments */
    .sticky-action-bar {
        padding: 10px 5px;
        margin: 0 -10px -10px;
    }
    
    .sticky-action-bar .action-buttons {
        gap: 6px;
    }
    
    .sticky-action-bar .action-buttons button {
        padding: 10px 8px;
        min-width: 70px;
        font-size: 0.75rem;
    }
    
    /* Aspect ratio buttons - wrap on mobile */
    .aspect-ratio-buttons {
        justify-content: center;
    }
    
    .aspect-btn {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    
    /* Accordion adjustments */
    .accordion-header {
        padding: 12px;
    }
    
    .accordion-header .info-card-title {
        font-size: 0.9rem;
    }
    
    /* Rotation indicator */
    .rotation-indicator span {
        font-size: 0.8rem;
        padding: 3px 10px;
    }
    
    /* Flip buttons */
    .flip-buttons.side-by-side {
        justify-content: center;
        gap: 15px;
    }
}

/* Extra small devices (up to 400px) */
@media (max-width: 400px) {
    /* Hide feedback button text, show only icon */
    .feedback-fab span {
        display: none;
    }
    
    .feedback-fab {
        padding: 12px;
        border-radius: 50%;
    }
    
    /* Stack action buttons vertically */
    .sticky-action-bar .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .sticky-action-bar .action-buttons button,
    .sticky-action-bar .download-container {
        width: 100%;
    }
    
    .download-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .download-container select {
        width: 100%;
    }
}
