/* === Wedding Photo Upload App — Styles === */

:root {
    --bg: #FAF8F5;
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --accent: #C9A96E;
    --accent-hover: #b8953d;
    --rose: #E8C4C0;
    --success: #7CAE7A;
    --error: #c44;
    --border: #e8e4df;
    --card-bg: #fff;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* === Guest Upload Page === */

.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 60px 24px 40px;
    text-align: center;
}

.flourish {
    font-size: 28px;
    color: var(--accent);
    margin-bottom: 16px;
    opacity: 0.7;
}

h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: 3rem;
    letter-spacing: 0.02em;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.1;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 300;
    margin-bottom: 32px;
    line-height: 1.5;
}

.guest-count {
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 32px;
    font-weight: 400;
}

/* Form */
.upload-form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.15);
}

/* Upload area */
.upload-area {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 40px 24px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
    position: relative;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.5);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: rgba(201, 169, 110, 0.04);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.upload-formats {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* File preview */
.file-preview {
    margin-bottom: 20px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.clear-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    padding: 4px 8px;
}

.clear-btn:hover {
    text-decoration: underline;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
}

.preview-thumb {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-icon {
    font-size: 1.5rem;
    opacity: 0.5;
}

.remove-thumb {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.preview-thumb:hover .remove-thumb {
    opacity: 1;
}

/* Submit button */
.submit-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.05rem;
    font-family: inherit;
    font-weight: 500;
    color: white;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s, transform 0.1s;
    letter-spacing: 0.02em;
}

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

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

.submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Progress */
.progress-section {
    text-align: center;
    padding: 40px 0;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--rose));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Success */
.success-section {
    text-align: center;
    padding: 40px 0;
    animation: fadeIn 0.5s ease;
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.success-section h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 2rem;
    margin-bottom: 8px;
}

.success-section p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.upload-more-btn {
    padding: 12px 28px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--accent);
    background: transparent;
    border: 1.5px solid var(--accent);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.upload-more-btn:hover {
    background: var(--accent);
    color: white;
}

/* Error */
.error-section {
    text-align: center;
    padding: 40px 0;
}

.error-section p {
    color: var(--error);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Footer */
footer {
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}

footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* Confetti canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    display: none;
}

/* === Admin Pages === */

.admin-body {
    background: #f5f5f5;
}

/* Admin login */
.admin-login {
    max-width: 380px;
    margin-top: 120px;
}

.login-form {
    margin-top: 24px;
}

.login-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text);
    margin-bottom: 16px;
    outline: none;
    text-align: center;
}

.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.15);
}

.login-error {
    color: var(--error);
    font-size: 0.9rem;
    margin-top: 12px;
}

/* Admin gallery */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.admin-header h1 {
    font-size: 1.8rem;
    font-weight: 400;
}

.admin-stats {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.download-all-btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--text);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.download-all-btn:hover {
    opacity: 0.85;
}

/* Photo grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.photo-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.photo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.photo-img-wrap {
    aspect-ratio: 4/3;
    overflow: hidden;
    cursor: pointer;
    background: var(--border);
}

.photo-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.photo-card:hover .photo-img-wrap img {
    transform: scale(1.03);
}

.photo-info {
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.photo-uploader {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
}

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

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-muted);
}

.empty-state p:first-child {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    z-index: 1;
}

.lightbox-close:hover {
    opacity: 1;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-info {
    margin-top: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
}

.lightbox-info p {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.lightbox-download-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.lightbox-download-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* === Animations === */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Responsive === */

@media (max-width: 600px) {
    .container {
        padding: 40px 20px 32px;
    }

    h1 {
        font-size: 2.4rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .upload-area {
        padding: 32px 16px;
    }

    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }

    .remove-thumb {
        opacity: 1;
    }

    .admin-container {
        padding: 16px;
    }

    .admin-header {
        flex-direction: column;
    }

    .admin-header h1 {
        font-size: 1.4rem;
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }

    .download-all-btn {
        width: 100%;
        text-align: center;
    }
}
