/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --stone-50: #FAFAF9;
    --stone-900: #1C1917;
    --stone-800: #292524;
    --stone-700: #44403C;
    --stone-600: #57534E;
    --stone-400: #A8A29E;
    --emerald-600: #047857;
    --emerald-700: #065F46;
    --emerald-50: #ECFDF5;
    --red-600: #DC2626;
    --red-50: #FEF2F2;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--stone-50);
    color: var(--stone-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeIn 0.6s ease-out;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--stone-900);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.tagline {
    font-size: 1.125rem;
    color: var(--stone-600);
    font-weight: 500;
}

/* Sections */
.section {
    background: white;
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.6s ease-out;
}

.section.hidden {
    display: none;
}

h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--stone-900);
    margin-bottom: 2rem;
    text-align: center;
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--stone-900);
    margin-bottom: 0.5rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--stone-400);
    border-radius: 0.75rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--stone-50);
}

.upload-area:hover {
    border-color: var(--emerald-600);
    background: var(--emerald-50);
}

.upload-area.drag-over {
    border-color: var(--emerald-600);
    background: var(--emerald-50);
    transform: scale(1.02);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--stone-400);
    margin: 0 auto 1rem;
}

.upload-area:hover .upload-icon {
    color: var(--emerald-600);
}

.upload-area h3 {
    color: var(--stone-900);
    margin-bottom: 0.25rem;
}

.upload-area p {
    color: var(--stone-600);
    margin-bottom: 0.25rem;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--stone-400);
}

/* Preview Container */
.preview-container {
    position: relative;
    margin-bottom: 2rem;
    border-radius: 0.75rem;
    overflow: hidden;
    animation: fadeIn 0.4s ease-out;
}

.preview-container img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
    border-radius: 0.75rem;
}

.btn-remove {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    color: var(--stone-700);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-remove:hover {
    background: var(--stone-900);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Style Input */
.style-input-group {
    margin: 2rem 0;
}

.style-input-group label {
    display: block;
    font-weight: 600;
    color: var(--stone-900);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

#style-input {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 2px solid var(--stone-400);
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--stone-900);
    resize: vertical;
    transition: all 0.2s ease;
}

#style-input:focus {
    outline: none;
    border-color: var(--emerald-600);
    box-shadow: 0 0 0 3px var(--emerald-50);
}

#style-input::placeholder {
    color: var(--stone-400);
}

.helper-text {
    font-size: 0.875rem;
    color: var(--stone-600);
    margin-top: 0.5rem;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--emerald-600);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--emerald-700);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.3);
}

.btn-primary:disabled {
    background: var(--stone-400);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: white;
    color: var(--stone-900);
    border: 2px solid var(--stone-400);
    margin-top: 2rem;
}

.btn-secondary:hover {
    background: var(--stone-900);
    color: white;
    border-color: var(--stone-900);
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 1rem;
}

.result-card {
    border-radius: 0.75rem;
    overflow: hidden;
    background: var(--stone-50);
}

.result-card h3 {
    padding: 1rem;
    text-align: center;
    background: white;
    border-bottom: 1px solid var(--stone-400);
}

.result-card img {
    width: 100%;
    height: auto;
    display: block;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(28, 25, 23, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--emerald-600);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

.loading-content h3 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.loading-content p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

/* Error Message */
.error-message {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 2px solid var(--red-600);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    max-width: 500px;
    width: 90%;
    animation: slideDown 0.3s ease-out;
}

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

.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.error-icon {
    width: 48px;
    height: 48px;
    color: var(--red-600);
    margin-bottom: 1rem;
}

.error-content p {
    color: var(--stone-900);
    margin-bottom: 1rem;
    font-weight: 500;
}

.btn-close {
    background: var(--red-600);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: #B91C1C;
    transform: translateY(-1px);
}

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

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

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

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    .section {
        padding: 1.5rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .upload-area {
        padding: 2rem 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem 0.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1rem;
    }
}
