/* Custom styles for AI Image Resize */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
    color: #1f2937;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.header h1 .emoji {
    font-size: 2.5rem;
}

.header p {
    font-size: 1.1rem;
    color: #4b5563;
}

/* Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #1f2937;
}

/* Controls Panel */
.controls-panel {
    position: sticky;
    top: 1rem;
}

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

.control-section:last-child {
    margin-bottom: 0;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

input[type="file"],
input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

input[type="file"]:hover,
input[type="number"]:hover {
    border-color: #3b82f6;
}

input[type="file"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input[type="file"] {
    cursor: pointer;
}

.file-hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Info Box */
.info-box {
    background: #eff6ff;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.875rem;
}

.info-box strong {
    color: #1e40af;
}

/* Instructions */
.instructions {
    font-size: 0.875rem;
    color: #4b5563;
    line-height: 1.6;
}

.instructions p {
    margin-bottom: 0.5rem;
}

/* Buttons */
button {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: #6b7280;
    color: white;
    margin-bottom: 1rem;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    margin-bottom: 1rem;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
}

/* Processing Info */
.processing-info {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.processing-info p {
    margin-bottom: 0.25rem;
}

.processing-info p:last-child {
    margin-bottom: 0;
}

/* Canvas Panel */
.canvas-panel {
    min-height: 500px;
}

/* Upload Prompt */
.upload-prompt {
    text-align: center;
    padding: 5rem 2rem;
}

.upload-prompt .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-prompt h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.upload-prompt p {
    color: #6b7280;
}

/* Crop Container */
.crop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.crop-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
}

.crop-header .dimensions {
    font-size: 0.875rem;
    color: #6b7280;
}

.crop-canvas {
    border: 2px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    max-height: 600px;
    background: #f9fafb;
}

.crop-canvas img {
    max-width: 100%;
    display: block;
}

.crop-info {
    background: #f9fafb;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.crop-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    font-size: 0.875rem;
}

.crop-info-grid strong {
    color: #1f2937;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 5rem 2rem;
}

.spinner {
    display: inline-block;
    width: 4rem;
    height: 4rem;
    border: 4px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    margin-top: 1.5rem;
    color: #374151;
    font-size: 1.125rem;
}

.loading-state .loading-hint {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* Result Panel */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.result-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
}

.result-header .start-over-btn {
    color: #3b82f6;
    background: none;
    border: none;
    padding: 0;
    width: auto;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: underline;
}

.result-header .start-over-btn:hover {
    color: #2563eb;
}

.result-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 2px solid #d1d5db;
    margin-bottom: 1rem;
}

.result-info-box {
    background: #d1fae5;
    border: 1px solid #10b981;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.result-info-box p {
    margin-bottom: 0.25rem;
}

.result-info-box p:last-child {
    margin-bottom: 0;
}

.result-info-box strong {
    color: #065f46;
}

/* Error State */
.error-box {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.error-title {
    font-weight: 700;
    color: #991b1b;
    margin-bottom: 0.5rem;
}

.error-message {
    color: #dc2626;
    font-size: 0.875rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.footer a {
    color: #3b82f6;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer p {
    margin-bottom: 0.5rem;
}

.footer p:last-child {
    margin-bottom: 0;
}

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

/* Tablet and below - stack vertically */
@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .controls-panel {
        position: static;
        margin-bottom: 1rem;
    }
}

/* Tablet specific optimizations */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    body {
        overflow-x: hidden;
    }
    
    .card {
        padding: 1rem;
    }
    
    .main-grid {
        gap: 1rem;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header p {
        font-size: 0.95rem;
    }
    
    .canvas-panel {
        min-height: 300px;
    }
    
    .crop-canvas {
        max-height: 400px;
    }
    
    button {
        padding: 1rem 1.5rem;
        font-size: 1.05rem;
    }
}

/* Mobile phone optimizations */
@media (max-width: 640px) {
    .crop-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .crop-header .dimensions {
        font-size: 0.75rem;
    }
    
    .crop-canvas {
        max-height: 300px;
        border-width: 1px;
    }
    
    .crop-info-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        font-size: 0.8rem;
    }
    
    .upload-prompt {
        padding: 3rem 1rem;
    }
    
    .upload-prompt .icon {
        font-size: 3rem;
    }
    
    .upload-prompt h3 {
        font-size: 1.25rem;
    }
    
    .upload-prompt p {
        font-size: 0.875rem;
    }
    
    .footer {
        font-size: 0.75rem;
        padding: 1rem;
    }
}