/**
 * Wedding Photo Uploader - Mobile-First Styles
 */

/* CSS Variables */
:root {
    --primary-color: #b8860b;
    --primary-hover: #9a7209;
    --primary-light: #f5e6c8;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --error-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background: linear-gradient(135deg, #fdf6e3 0%, #f5e6c8 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: env(safe-area-inset-bottom, 1rem);
}

/* Header */
.header {
    text-align: center;
    padding: 2rem 1rem;
    margin-bottom: 1.5rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.header .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.header .date {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Form */
.upload-form {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.upload-form.hidden {
    display: none;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* File Input */
.file-input-wrapper {
    position: relative;
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-input-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    transition: border-color 0.2s, background 0.2s;
    min-height: 120px;
}

.file-input:focus + .file-input-button,
.file-input-wrapper:hover .file-input-button {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.file-input-button .icon {
    width: 40px;
    height: 40px;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.file-input-button span {
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-color);
}

/* Preview Area */
.preview-area {
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.preview-area.hidden {
    display: none;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.preview-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-text {
    background: none;
    border: none;
    color: var(--error-color);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.btn-text:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.preview-list {
    max-height: 300px;
    overflow-y: auto;
}

.preview-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.preview-item:last-child {
    border-bottom: none;
}

.preview-item.complete {
    background: #ecfdf5;
}

.preview-item.error {
    background: #fef2f2;
}

.preview-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.preview-thumb.preview-icon {
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-thumb.preview-icon svg {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
}

.preview-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.preview-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.preview-progress {
    width: 80px;
    flex-shrink: 0;
}

.preview-progress.hidden {
    display: none;
}

.mini-progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s;
}

.complete-check {
    color: var(--success-color);
    font-weight: bold;
}

.error-text {
    color: var(--error-color);
    font-size: 0.7rem;
}

.preview-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.preview-remove:hover {
    background: #fee2e2;
    color: var(--error-color);
}

.preview-remove:disabled {
    display: none;
}

.preview-remove svg {
    width: 18px;
    height: 18px;
}

/* Overall Progress */
.overall-progress {
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.overall-progress.hidden {
    display: none;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    width: 0%;
    transition: width 0.3s;
}

.progress-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 56px; /* Touch target */
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-primary .btn-text-content.hidden,
.btn-primary .btn-loading.hidden {
    display: none;
}

.btn-primary .btn-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

.btn-secondary {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-color);
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
    min-height: 48px;
}

.btn-secondary:hover {
    background: var(--primary-light);
}

/* Success Message */
.success-message {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2.5rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.success-message.hidden {
    display: none;
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: #ecfdf5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon svg {
    width: 40px;
    height: 40px;
    color: var(--success-color);
}

.success-message h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.success-message p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* iOS Safe Area */
@supports (padding: env(safe-area-inset-bottom)) {
    .container {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

/* Responsive adjustments */
@media (min-width: 640px) {
    .container {
        padding: 2rem;
    }
    
    .header {
        padding: 3rem 1rem;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    .upload-form {
        padding: 2rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #666;
        --text-muted: #666;
    }
    
    .file-input-button {
        border-width: 3px;
    }
}

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

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    .upload-form,
    .success-message {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
