/* ===== MAIN APP LAYOUT ===== */

.app-container {
    display: none;
    min-height: 100vh;
    background: var(--bg-primary);
    overflow-x: hidden;
}

.app-container.active {
    display: block;
}

/* ── Top Navigation ── */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 240, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    transition: background var(--transition-slow);
}

[data-theme="private"] .top-nav {
    background: rgba(18, 10, 20, 0.92);
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 64px;
    gap: 20px;
}

.nav-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nav-logo svg {
    width: 28px;
    height: 28px;
    fill: var(--accent-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 24px;
    min-width: 0;
    flex-shrink: 1;
}

.nav-link {
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    border: none;
    background: none;
}

.nav-link:hover {
    color: var(--accent-primary);
    background: var(--accent-lighter);
}

.nav-link.active {
    color: var(--accent-primary);
    background: var(--accent-lighter);
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 2px;
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Private Toggle */
.private-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
}

.private-toggle .toggle-track {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--border-color);
    position: relative;
    transition: background var(--transition-base);
}

.private-toggle .toggle-thumb {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: #FFF;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform var(--transition-base);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.private-toggle.active .toggle-track {
    background: #8E4585;
}

.private-toggle.active .toggle-thumb {
    transform: translateX(20px);
}

/* User avatar in nav */
.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 12px 4px 4px;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.nav-user:hover {
    background: var(--accent-lighter);
}

.nav-user img {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--accent-light);
}

.nav-user span {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Logout dropdown */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    display: none;
    z-index: 200;
    overflow: hidden;
}

.nav-dropdown.show {
    display: block;
    animation: scaleIn 0.2s ease;
}

.nav-dropdown button {
    width: 100%;
    padding: 12px 18px;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.88rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.nav-dropdown button:hover {
    background: var(--accent-lighter);
    color: var(--accent-primary);
}

/* ── Dashboard / Profile Section ── */
.dashboard-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px 0;
}

.dashboard-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--accent-lighter) 100%);
    border-radius: var(--radius-xl);
    padding: 36px;
    display: flex;
    align-items: center;
    gap: 36px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(var(--accent-primary-rgb), 0.06) 0%, transparent 70%);
    border-radius: var(--radius-full);
}

.couple-pics {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
    position: relative;
}

.couple-pics img {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.couple-pics img:last-of-type {
    margin-left: -20px;
}

.couple-heart {
    position: absolute;
    top: -8px;
    /* Total width = 72 + 72 - 20(overlap) = 124px, center = 62px */
    left: calc(50% - 10px);
    transform: translateX(-50%);
    background: var(--accent-primary);
    color: #FFF;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    box-shadow: 0 2px 8px rgba(var(--accent-primary-rgb), 0.4);
    animation: pulse 3s infinite;
    z-index: 2;
}

.dashboard-info {
    flex: 1;
}

.dashboard-info h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.days-counter {
    color: var(--accent-primary);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.days-counter .day-number {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
}

.dashboard-stats {
    display: flex;
    gap: 24px;
    margin-top: 14px;
}

.stat-item {
    text-align: center;
}

.stat-item .stat-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-item .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Special Date (anniversary in dashboard) ── */
.special-date {
    margin-left: auto;
    text-align: right;
    flex-shrink: 0;
}

.special-date .date-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--wine-red), var(--accent-primary));
    color: #FFF;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(114, 47, 55, 0.25);
}

/* ── Main Content Area ── */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text-primary);
}

/* ── On This Day Section ── */
.on-this-day {
    margin-bottom: 32px;
    padding: 28px;
    background: linear-gradient(135deg, var(--champagne-light) 0%, var(--champagne) 100%);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(241, 229, 172, 0.5);
}

[data-theme="private"] .on-this-day {
    background: linear-gradient(135deg, rgba(142, 69, 133, 0.15) 0%, rgba(142, 69, 133, 0.08) 100%);
    border-color: rgba(142, 69, 133, 0.2);
}

.on-this-day h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--wine-red);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-theme="private"] .on-this-day h3 {
    color: var(--accent-hover);
}

.on-this-day-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
}

.on-this-day-grid::-webkit-scrollbar {
    height: 4px;
}

.memory-card {
    flex-shrink: 0;
    width: 140px;
    scroll-snap-align: start;
}

.memory-card img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 3px solid #FFF;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all var(--transition-base);
}

.memory-card img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.memory-card .memory-year {
    text-align: center;
    font-size: 0.78rem;
    color: var(--wine-dark);
    margin-top: 6px;
    font-weight: 500;
}

/* ── FAB (Upload Button) ── */
.fab {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    color: #FFF;
    border: none;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(var(--accent-primary-rgb), 0.4);
    z-index: 50;
    cursor: pointer;
    transition: all var(--transition-base);
    animation: pulse 3s infinite;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(var(--accent-primary-rgb), 0.55);
    animation: none;
}

/* ── Upload Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--text-primary);
}

.modal-close {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--accent-lighter);
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--accent-primary);
    color: #FFF;
}

.modal-body {
    padding: 24px 28px;
}

.modal-footer {
    padding: 16px 28px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Upload area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--accent-lighter);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(var(--accent-primary-rgb), 0.08);
}

.upload-area .upload-icon {
    font-size: 3rem;
    color: var(--accent-light);
    margin-bottom: 12px;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.upload-area .browse-link {
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: underline;
}

/* Upload preview list */
.upload-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.upload-preview .preview-thumb {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
}

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

.upload-progress {
    margin-top: 16px;
}

.progress-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

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

.progress-text {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .top-nav {
        padding: 0 16px;
    }

    .nav-inner {
        height: 56px;
        padding: 0;
        gap: 12px;
    }

    .nav-logo {
        font-size: 1.15rem;
        gap: 6px;
    }

    .nav-logo svg {
        width: 22px;
        height: 22px;
    }

    .nav-links {
        margin-left: 8px;
        gap: 2px;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .dashboard-section {
        padding: 20px 16px 0;
    }

    .dashboard-card {
        flex-direction: column;
        text-align: center;
        align-items: center;
        padding: 28px 20px;
        gap: 16px;
    }

    .couple-pics {
        justify-content: center;
    }

    .dashboard-info {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .days-counter {
        justify-content: center;
        text-align: center;
    }

    .dashboard-stats {
        justify-content: center;
    }

    .special-date {
        margin-left: 0;
        text-align: center;
    }

    .fab {
        bottom: 20px;
        right: 20px;
        width: 54px;
        height: 54px;
        font-size: 1.4rem;
    }

    .main-content {
        padding: 16px;
    }

    .modal-overlay {
        padding: 10px;
    }

    .modal {
        border-radius: var(--radius-lg);
    }

    .modal-header {
        padding: 18px 20px 14px;
    }

    .modal-body {
        padding: 18px 20px;
    }

    .modal-footer {
        padding: 14px 20px 18px;
    }

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

/* iPhone 15 Pro and similar (≤430px) */
@media (max-width: 430px) {
    .top-nav {
        padding: 0 10px;
    }

    .nav-inner {
        gap: 4px;
        overflow: hidden;
    }

    .nav-logo {
        font-size: 0.95rem;
        gap: 4px;
        letter-spacing: 0;
    }

    .nav-logo svg {
        width: 20px;
        height: 20px;
    }

    .nav-user span {
        display: none;
    }

    .nav-user {
        padding: 4px;
    }

    .nav-link {
        padding: 4px 6px;
        font-size: 0.72rem;
    }

    .private-toggle span {
        display: none;
    }

    .private-toggle .toggle-track {
        width: 34px;
        height: 20px;
    }

    .private-toggle .toggle-thumb {
        width: 16px;
        height: 16px;
    }

    .nav-links {
        margin-left: 4px;
        gap: 1px;
    }

    .nav-right {
        gap: 8px;
    }

    .nav-user img {
        width: 30px;
        height: 30px;
    }

    .dashboard-section {
        padding: 16px 12px 0;
    }

    .dashboard-card {
        padding: 24px 16px;
        gap: 14px;
        border-radius: var(--radius-lg);
        width: 100%;
        box-sizing: border-box;
    }

    .couple-pics img {
        width: 62px;
        height: 62px;
    }

    .couple-pics img:last-of-type {
        margin-left: -16px;
    }

    .couple-heart {
        left: calc(50% - 8px);
        width: 22px;
        height: 22px;
        font-size: 0.6rem;
    }

    .dashboard-info h2 {
        font-size: 1.15rem;
    }

    .days-counter {
        font-size: 0.82rem;
    }

    .days-counter .day-number {
        font-size: 1.15rem;
    }

    .stat-item .stat-value {
        font-size: 1.25rem;
    }

    .special-date .date-badge {
        padding: 8px 14px;
        font-size: 0.78rem;
    }

    .main-content {
        padding: 12px;
    }

    .section-header h2 {
        font-size: 1.1rem;
    }

    .on-this-day {
        padding: 20px 16px;
        margin-bottom: 20px;
    }

    .fab {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }

    .fab svg {
        width: 20px;
        height: 20px;
    }

    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
    }

    .toast {
        max-width: 100%;
        font-size: 0.82rem;
        padding: 12px 16px;
    }
}