/* Mobile and Tablet Responsive Styles */

/* Mobile Responsive Styles (768px and below) */
@media (max-width: 768px) {
    .app-container {
        display: flex;
        flex-direction: column;
        height: auto;
        gap: 0;
        background-color: transparent; /* Remove grey background */
        margin-bottom: 20px; /* Reduced to eliminate excessive white space */
        padding-bottom: env(safe-area-inset-bottom, 0px); /* Safe area support */
    }

    .section {
        width: 100% !important;
        min-width: unset;
        min-height: 150px; /* Reduced from 200px to minimize empty space */
        border-bottom: 1px solid var(--border-color);
        background-color: var(--bg-color); /* Ensure solid background */
    }
    
    /* Further reduce checklist min-height when sparse */
    .checklist-section {
        min-height: 120px; /* Even smaller for checklist to show calculator sooner */
    }

    .section:last-child {
        border-bottom: none;
        margin-bottom: 16px; /* Reduced to eliminate excessive spacing */
    }

    .resize-handle {
        width: 100%;
        height: 4px;
        cursor: row-resize;
        background-color: var(--border-color);
    }

    .resize-handle::before {
        width: 30px;
        height: 8px;
        background: linear-gradient(to bottom, 
            transparent 2px, 
            var(--border-color) 2px, 
            var(--border-color) 3px, 
            transparent 3px, 
            transparent 5px,
            var(--border-color) 5px,
            var(--border-color) 6px,
            transparent 6px
        );
    }

    .notes-textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 120px;
    }

    .checklist-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
    }

    .calculator-buttons {
        gap: 12px;
    }

    .calc-btn {
        padding: 16px;
        font-size: 16px;
        font-weight: 500;
        min-height: 48px;
        border-radius: 6px;
    }

    .calculator-display {
        font-size: 18px;
        padding: 16px;
        min-height: 56px;
    }

    .footer-content {
        padding: 0 15px;
        height: 56px; /* Slightly larger on mobile for better touch targets */
    }
    
    .app-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        transform: translateY(0);
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    }
    
    /* Progressive enhancement: footer visibility states for mobile */
    .app-footer.footer-hidden {
        transform: translateY(100%);
    }
    
    .app-footer.footer-visible {
        transform: translateY(0);
    }

    .toggle-slider {
        width: 56px;
        height: 32px;
    }

    .toggle-button {
        height: 26px;
        width: 26px;
        top: 2px;
        left: 3px;
    }

    .theme-toggle input:checked + .toggle-slider .toggle-button {
        transform: translateX(24px);
    }

    .checklist-item {
        padding: 12px;
        margin-bottom: 8px;
    }

    .reorder-controls {
        opacity: 1;
        flex-direction: row;
        gap: 8px;
        margin-left: 12px;
    }

    .reorder-btn {
        padding: 10px 12px;
        min-height: 44px;
        min-width: 44px;
        font-size: 14px;
    }

    .delete-btn {
        padding: 8px 12px;
        font-size: 16px;
    }
    
    /* Timer mobile styles - consolidated */
    .timer-container {
        padding: 16px 12px;
        margin: 12px 0;
    }
    
    .timer-display {
        font-size: 20px;
        padding: 12px;
    }
    
    .timer-display:focus {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .timer-btn {
        width: 48px;
        height: 48px;
    }
    
    .timer-controls {
        gap: 12px;
        margin-bottom: 20px !important; /* Normal project margin scale */
        position: relative;
        z-index: 1;
    }
    
    .timer-subsection {
        padding-bottom: 16px !important;
    }
    
    .calculator-section:last-child {
        padding-bottom: 20px !important;
    }
}

@media (max-width: 480px) {
    .app-container {
        margin-bottom: 20px; /* Reduced to eliminate excessive white space on small screens */
        padding-bottom: env(safe-area-inset-bottom, 0px); /* Safe area support */
    }

    .section {
        padding: 16px;
    }

    .section-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .footer-content {
        padding: 0 12px;
        height: 52px;
    }

    .footer-link {
        font-size: 11px;
    }

    .calc-btn {
        padding: 15px;
        font-size: 16px;
        min-height: 45px;
    }

    .calculator-display {
        font-size: 18px;
        padding: 15px;
        min-height: 55px;
    }

    .settings-content {
        padding: 15px;
    }
}

/* Touch-specific improvements */
@media (hover: none) and (pointer: coarse) {
    .calc-btn:active {
        background-color: var(--button-hover);
        transform: scale(0.95);
    }

    .settings-btn:active {
        background-color: var(--button-hover);
        transform: scale(0.98);
    }

    .checklist-item:active {
        background-color: var(--button-hover);
    }

    /* Larger touch targets */
    .delete-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Desktop Optimizations */
@media (min-width: 769px) {
    /* Desktop-specific checklist item height to match calculator buttons */
    .checklist-item {
        padding: 14px !important; /* Exact match with calc-btn padding */
        height: 48px !important; /* Exact match with calc-btn dimensions */
        margin-bottom: var(--spacing-xs) !important; /* Match calculator grid gap */
        box-sizing: border-box !important; /* Ensure consistent box model */
    }
}
