/* ═══════════════════════════════════════════════
   COMMUNITY DIRECTORY — style.css
   ═══════════════════════════════════════════════ */

/* ── Design Tokens — Dark (default) ── */
:root {
    --bg:           #0d0f14;
    --surface:      #13161e;
    --surface2:     #1a1e28;
    --border:       #2a2f3e;
    --gold:         #c9a84c;
    --gold-light:   #e8c97a;
    --gold-glow:    rgba(201, 168, 76, 0.12);
    --cream:        #f0ead6;
    --muted:        #6b7280;
    --text:         #e8e2d5;
    --error:        #e05c5c;
    --success:      #4caf7d;
    --radius-sm:    10px;
    --radius-md:    12px;
    --radius-lg:    16px;
}

/* ── Design Tokens — Light ── */
[data-theme="light"] {
    --bg:           #f7f3ec;
    --surface:      #ffffff;
    --surface2:     #f0ece3;
    --border:       #e2d9c8;
    --gold:         #9a6f20;
    --gold-light:   #c9a84c;
    --gold-glow:    rgba(154, 111, 32, 0.08);
    --cream:        #1e1b16;
    --muted:        #7a7060;
    --text:         #2e2b25;
    --error:        #c0392b;
    --success:      #276744;
}

[data-theme="light"] body {
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -10%, var(--gold-glow) 0%, transparent 60%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239a6f20' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

[data-theme="light"] .field select option {
    background: #ffffff;
    color: var(--text);
}

[data-theme="light"] .toast {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

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

/* ── Base ── */
body {
    background-color: var(--bg);
    background-image:
            radial-gradient(ellipse 80% 60% at 50% -10%, var(--gold-glow) 0%, transparent 60%),
            url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9a84c' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    min-height: 100vh;
    padding: 40px 16px 80px;
    -webkit-font-smoothing: antialiased;
}

/* ── Page Wrapper ── */
.page-wrapper {
    max-width: 680px;
    margin: 0 auto;
}

/* ════════════════════════════
   HEADER
════════════════════════════ */
.header {
    text-align: center;
    margin-bottom: 43px;
    animation: fadeDown 0.7s ease both;
}

.header .badge {
    display: inline-block;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold);
    border: 1px solid rgba(201, 168, 76, 0.3);
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 20px;
    background: rgba(201, 168, 76, 0.05);
}

.header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(38px, 7vw, 58px);
    font-weight: 600;
    color: var(--cream);
    line-height: 1.1;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.header h1 span {
    color: var(--gold);
}

.header p {
    font-size: 15px;
    font-weight: 300;
    color: var(--muted);
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ════════════════════════════
   CARD
════════════════════════════ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    animation: fadeUp 0.7s ease both;
}

/* ════════════════════════════
   PROGRESS BAR
════════════════════════════ */
.progress-bar {
    height: 2px;
    background: var(--border);
    border-radius: 2px;
    margin-bottom: 32px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 2px;
    width: 0%;
    transition: width 0.4s ease;
}

/* ════════════════════════════
   SUCCESS SCREEN
════════════════════════════ */
.success-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 48px 24px;
    animation: fadeUp 0.6s ease;
}

.success-screen.show {
    display: flex;
}

.success-screen .check {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(76, 175, 125, 0.15);
    border: 1px solid rgba(76, 175, 125, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin-bottom: 24px;
}

.success-screen h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px;
    font-weight: 600;
    color: var(--cream);
    margin-bottom: 12px;
}

.success-screen p {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.7;
}

/* ════════════════════════════
   PHOTO UPLOAD
════════════════════════════ */
.photo-upload-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}

.photo-ring {
    position: relative;
    width: 172px;
    height: 172px;
    border-radius: 50%;
    cursor: pointer;
}

/* Spinning dashed circular border */
.photo-ring::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px dashed var(--gold);
    animation: spin 20s linear infinite;
    opacity: 0.7;
    transition: border-color 0.2s, opacity 0.2s;
}

.photo-preview {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--surface2);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.photo-preview .icon {
    color: var(--muted);
    font-size: 28px;
    transition: color 0.2s;
}

/* Hover state */
.photo-ring:hover .photo-preview {
    border-color: var(--gold);
}

.photo-ring:hover::before {
    opacity: 1;
}

.photo-ring:hover .icon {
    color: var(--gold);
}

/* ── Photo Error State ── */
.photo-preview.photo-error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(224, 92, 92, 0.15);
}

.photo-preview.photo-error .icon {
    color: var(--error);
}

.photo-ring:has(.photo-error)::before {
    border-color: var(--error);
    opacity: 1;
}

/* Photo error label */
.photo-err-msg {
    font-size: 11px;
    color: var(--error);
    display: none;
    text-align: center;
    margin-top: -4px;
}

.photo-preview.photo-error ~ .photo-err-msg,
.photo-upload-wrapper:has(.photo-error) .photo-err-msg {
    display: block;
}

.photo-label {
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    line-height: 1.8;
}

.photo-label strong {
    color: var(--gold);
    cursor: pointer;
}

.photo-label strong:hover {
    text-decoration: underline;
}

.photo-hint {
    font-size: 11px;
}

input[type="file"] {
    display: none;
}

/* ════════════════════════════
   SECTION DIVIDER
════════════════════════════ */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0 24px;
}

.divider hr {
    flex: 1;
    border: none;
    border-top: 1px solid var(--border);
}

.divider span {
    font-family: 'Cormorant Garamond', serif;
    font-size: 13px;
    color: var(--gold);
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ════════════════════════════
   FORM GRID
════════════════════════════ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

/* ════════════════════════════
   FIELD
════════════════════════════ */
.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gold);
}

.field label .req {
    color: var(--error);
    margin-left: 3px;
}

.field input,
.field select,
.field textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 300;
    padding: 12px 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
}

/* Override autofill background color */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.field input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--surface2) inset !important;
    box-shadow: 0 0 0 30px var(--surface2) inset !important;
    -webkit-text-fill-color: var(--text) !important;
}

.field input::placeholder {
    color: var(--muted);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}

.field input.error,
.field select.error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(224, 92, 92, 0.10);
}

/* Date input calendar icon tint */
.field input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.5) sepia(1) saturate(2) hue-rotate(5deg);
    cursor: pointer;
    opacity: 0.6;
}

/* ── Select wrapper ── */
.select-wrap {
    position: relative;
}

.select-wrap::after {
    content: '▾';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    font-size: 12px;
}

.field select {
    cursor: pointer;
}

.field select option {
    background: #1a1e28;
    color: var(--text);
}

/* ── Hint & error messages ── */
.field .hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
    font-style: italic;
}

.field .err-msg {
    font-size: 11px;
    color: var(--error);
    display: none;
}

.field.has-error .err-msg {
    display: block;
}

/* ════════════════════════════
   SUBMIT BUTTON
════════════════════════════ */
.submit-btn {
    width: 100%;
    margin-top: 32px;
    padding: 16px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #0d0f14;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(201, 168, 76, 0.25);
}

.submit-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.submit-btn .btn-text {
    transition: opacity 0.2s;
}

.submit-btn .btn-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.submit-btn.loading .btn-text   { opacity: 0; }
.submit-btn.loading .btn-loader { opacity: 1; }

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(13, 15, 20, 0.3);
    border-top-color: #0d0f14;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ════════════════════════════
   TOAST NOTIFICATION
════════════════════════════ */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 24px;
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success     { border-color: rgba(76, 175, 125, 0.4); }
.toast.error-toast { border-color: rgba(224, 92, 92, 0.4); }

.toast .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.toast.success     .dot { background: var(--success); }
.toast.error-toast .dot { background: var(--error); }

/* ════════════════════════════
   KEYFRAME ANIMATIONS
════════════════════════════ */
@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

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

/* ════════════════════════════
   CONFIRMATION MODAL
════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(24px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
}

.modal-overlay.show .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    text-align: center;
    margin-bottom: 28px;
}

.modal-icon {
    font-size: 22px;
    color: var(--gold);
    margin-bottom: 12px;
}

.modal-header h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 26px;
    font-weight: 600;
    color: var(--cream);
    margin-bottom: 8px;
}

.modal-header p {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
}

/* Summary rows */
.modal-summary {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 28px;
}

.summary-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row:hover {
    background: var(--surface2);
}

.summary-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gold);
    min-width: 110px;
    flex-shrink: 0;
}

.summary-value {
    font-size: 13px;
    color: var(--text);
    word-break: break-word;
}

.summary-value.empty {
    color: var(--muted);
    font-style: italic;
}

/* Action buttons */
.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    border: none;
}

.modal-cancel {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
}

.modal-cancel:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.modal-confirm {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    color: #0d0f14;
}

.modal-confirm:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(201, 168, 76, 0.3);
}

.modal-confirm:active {
    transform: translateY(0);
}

/* ════════════════════════════
   THEME TOGGLE BUTTON
════════════════════════════ */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--gold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.theme-toggle:hover {
    border-color: var(--gold);
    transform: rotate(20deg) scale(1.08);
    box-shadow: 0 4px 20px rgba(201, 168, 76, 0.25);
}

/* Show moon in dark mode, sun in light mode */
[data-theme="dark"]  .icon-sun  { display: none; }
[data-theme="dark"]  .icon-moon { display: block; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: block; }

/* ════════════════════════════
   FOOTER ATTRIBUTION
════════════════════════════ */
.footer-attribution {
    text-align: center;
    margin-top: 40px;
    padding-bottom: 10px;
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
    letter-spacing: 0.5px;
}

/* ════════════════════════════
   RESPONSIVE — Mobile
════════════════════════════ */
@media (max-width: 560px) {
    .header h1 {
        white-space: normal;
    }

    .card {
        padding: 24px 20px;
    }

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

    .form-grid .full {
        grid-column: 1;
    }

    .toast {
        left: 16px;
        right: 16px;
        white-space: normal;
        transform: translateX(0) translateY(100px);
    }

    .toast.show {
        transform: translateX(0) translateY(0);
    }
}
