/* =============================================
   StoryForest Auth Pages — Shared Styles
   login.html, signup.html, download.html
   ============================================= */

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

body {
    font-family: 'Noto Sans KR', 'Outfit', system-ui, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 30%, #fef3c7 70%, #fffbeb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ---- Background ---- */
.auth-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}

.bg-circle-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
    background: #86efac;
}

.bg-circle-2 {
    width: 300px;
    height: 300px;
    bottom: -50px;
    left: -50px;
    background: #fde68a;
}

.bg-circle-3 {
    width: 250px;
    height: 250px;
    top: 40%;
    left: 60%;
    background: #bbf7d0;
}

.leaf-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.floating-leaf {
    position: absolute;
    left: var(--x);
    top: -30px;
    width: 18px;
    height: 18px;
    background: rgba(34, 197, 94, 0.25);
    border-radius: 0 50% 50% 50%;
    transform: rotate(45deg);
    animation: leafDrop var(--dur) linear infinite;
    animation-delay: var(--delay);
}

@keyframes leafDrop {
    0% {
        transform: translateY(-30px) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.5;
    }

    90% {
        opacity: 0.5;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ---- Wrapper ---- */
.auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* ---- Logo ---- */
.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.2s;
}

.auth-logo:hover {
    opacity: 0.8;
}

.auth-logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #059669, #16a34a, #22c55e);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}

.auth-logo-text {
    display: flex;
    flex-direction: column;
}

.auth-logo-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 18px;
    color: #166534;
    letter-spacing: -0.5px;
}

.auth-logo-tag {
    font-size: 11px;
    color: #16a34a;
    font-weight: 500;
    margin-top: -2px;
}

/* ---- Card ---- */
.auth-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1.5px solid rgba(22, 163, 74, 0.15);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    padding: 36px 32px;
    animation: cardIn 0.5s ease-out;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ---- Header ---- */
.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.auth-title {
    font-size: 22px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 14px;
    color: #6b7280;
}

/* ---- Error ---- */
.auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
    animation: shake 0.3s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

/* ---- Buttons ---- */
.btn-auth {
    width: 100%;
    padding: 14px 20px;
    border-radius: 14px;
    border: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    position: relative;
}

.btn-auth:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-auth.loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    position: absolute;
    right: 16px;
}

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

.btn-google {
    background: white;
    border: 2px solid #e5e7eb;
    color: #374151;
}

.btn-google:hover:not(:disabled) {
    border-color: #d1d5db;
    background: #f9fafb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.btn-email {
    background: linear-gradient(135deg, #059669, #16a34a);
    color: white;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
}

.btn-email:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.35);
}

.btn-signup-email {
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.btn-signup-email:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.btn-submit {
    background: linear-gradient(135deg, #059669, #16a34a);
    color: white;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
    margin-top: 8px;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.35);
}

.btn-submit-signup {
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.btn-submit-signup:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.btn-secondary {
    background: white;
    border: 2px solid #e5e7eb;
    color: #6b7280;
    font-size: 13px;
    padding: 10px 16px;
    margin-top: 8px;
}

.btn-secondary:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-back {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 13px;
    color: #9ca3af;
    cursor: pointer;
    margin-bottom: 16px;
    padding: 4px 0;
    transition: color 0.2s;
}

.btn-back:hover {
    color: #6b7280;
}

/* ---- Divider ---- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.auth-divider span {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ---- Form ---- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    color: #111827;
    outline: none;
    transition: all 0.2s;
}

.form-group input:focus {
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}

.form-group input::placeholder {
    color: #d1d5db;
}

.form-hint {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

/* ---- Verify screen ---- */
.verify-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
}

.verify-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    text-align: center;
    margin-bottom: 8px;
}

.verify-desc {
    font-size: 13px;
    color: #6b7280;
    text-align: center;
    margin-bottom: 4px;
    line-height: 1.6;
}

.verify-email {
    font-size: 14px;
    font-weight: 700;
    color: #f59e0b;
    text-align: center;
    margin-bottom: 20px;
}

.verify-hint {
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
    margin-top: 12px;
}

/* ---- Footer ---- */
.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.auth-footer p {
    font-size: 13px;
    color: #9ca3af;
}

.auth-footer a {
    color: #16a34a;
    font-weight: 700;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: #059669;
}

.auth-home-link {
    font-size: 13px;
    color: #6b7280;
    transition: color 0.2s;
}

.auth-home-link:hover {
    color: #16a34a;
}

/* ============= Download Page ============= */
.download-card {
    text-align: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 28px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #059669, #22c55e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    overflow: hidden;
}

.user-details {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.user-name {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.user-email {
    font-size: 12px;
    color: #6b7280;
}

.download-section {
    margin-bottom: 28px;
}

.download-heading {
    font-size: 16px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 14px;
}

.btn-store {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 20px;
    border-radius: 14px;
    color: white;
    font-family: inherit;
    transition: all 0.2s;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}

.btn-playstore {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.btn-appstore {
    background: linear-gradient(135deg, #1f2937, #111827);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.btn-store:hover {
    transform: translateY(-2px);
}

.store-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.store-label {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 500;
}

.store-name {
    font-size: 17px;
    font-weight: 700;
}

.coming-soon-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.download-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 24px;
}

.download-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
}

.account-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.account-actions button {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 2px;
    transition: color 0.2s;
}

.action-dot {
    color: #d1d5db;
    font-size: 14px;
    user-select: none;
}

.btn-logout {
    color: #9ca3af;
}

.btn-logout:hover {
    color: #6b7280;
}

.btn-delete-account {
    color: #d1d5db;
}

.btn-delete-account:hover {
    color: #ef4444;
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-card {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.modal-desc {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions .btn-auth {
    flex: 1;
    padding: 12px;
    font-size: 14px;
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35);
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .auth-wrapper {
        padding: 16px;
    }

    .auth-card {
        padding: 28px 20px;
        border-radius: 20px;
    }

    .auth-title {
        font-size: 20px;
    }

    .download-features {
        grid-template-columns: 1fr;
    }
}