:root {
    --primary: #ff6f61;
    --primary-strong: #ff4d67;
    --accent: #0ea5e9;
    --ink: #0f172a;
    --muted: #64748b;
    --muted-strong: #475569;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-alt: #f1f5f9;
    --border: #e2e8f0;
    --shadow-soft: 0 12px 40px rgba(15, 23, 42, 0.08);
    --shadow-strong: 0 24px 80px rgba(15, 23, 42, 0.12);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --transition: 0.25s ease;
    /* Legacy aliases to keep compatibility with other theme files */
    --primary-color: var(--primary);
    --primary-dark: var(--primary-strong);
    --secondary-color: var(--accent);
    --bg-color: var(--bg);
    --card-bg: var(--surface);
    --text-primary: var(--ink);
    --text-secondary: var(--muted);
    --shadow: var(--shadow-soft);
    --shadow-lg: var(--shadow-strong);
    --border-color: var(--border);
}

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

body {
    margin: 0;
    font-family: 'Manrope', 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at 10% 20%, rgba(255, 111, 97, 0.08), transparent 25%),
                radial-gradient(circle at 90% 10%, rgba(14, 165, 233, 0.08), transparent 25%),
                linear-gradient(180deg, #fdfcfe 0%, #f3f6fb 60%, #eef2f7 100%);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
    margin: 0;
    color: var(--ink);
    letter-spacing: -0.01em;
}

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

.subtitle {
    color: var(--muted-strong);
    font-weight: 600;
    margin: 4px 0;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-wide {
    max-width: 1200px;
}

.main-content {
    padding: 20px 0 24px;
}

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

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--ink);
}

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

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-strong);
    border-color: rgba(255, 111, 97, 0.25);
}

.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--muted-strong);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.nav-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--ink);
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logo-text {
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.08em;
    box-shadow: 0 10px 25px rgba(255, 111, 97, 0.28);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--muted-strong);
    font-weight: 600;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.nav-link:hover {
    background: var(--surface-alt);
    color: var(--ink);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(255, 111, 97, 0.14), rgba(14, 165, 233, 0.14));
    color: var(--ink);
    box-shadow: 0 8px 24px rgba(255, 111, 97, 0.12);
}

.logout-form {
    margin: 0;
}

.btn-logout {
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--muted-strong);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition);
}

.btn-logout:hover {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-soft);
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    border-radius: 4px;
    transition: transform var(--transition), opacity var(--transition);
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
    font-family: 'Manrope', sans-serif;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
    box-shadow: 0 12px 30px rgba(255, 111, 97, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 40px rgba(255, 111, 97, 0.45);
}

.btn-secondary {
    background: var(--surface-alt);
    color: var(--ink);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    box-shadow: 0 12px 30px rgba(239, 68, 68, 0.35);
}

.btn-small {
    padding: 10px 14px;
    font-size: 0.95rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

/* Alerts */
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 600;
    margin-bottom: 14px;
}

.alert-error {
    background: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
}

.alert-success {
    background: #ecfdf3;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* Login */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
    background: radial-gradient(circle at 20% 20%, rgba(255, 111, 97, 0.16), transparent 30%),
                radial-gradient(circle at 80% 0%, rgba(14, 165, 233, 0.18), transparent 30%),
                #0f172a;
}

.login-container {
    width: 100%;
    max-width: 480px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 36px;
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.login-header {
    text-align: center;
    margin-bottom: 18px;
}

.logo {
    font-size: 2.3rem;
    margin-bottom: 6px;
    color: var(--ink);
}

.subtitle {
    color: var(--muted);
    font-weight: 600;
}

/* Forms */
.form-container {
    padding: 28px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.form-container-spacious {
    padding: 40px 48px;
    max-width: 1000px;
    margin: 0 auto;
}

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

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-weight: 700;
    color: var(--muted-strong);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select,
.location-search-input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    font-size: 1rem;
    font-family: 'Manrope', sans-serif;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.location-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 111, 97, 0.15);
    background: #fff;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.form-actions .btn {
    flex: 1;
    min-width: 140px;
}

/* Hero + Dashboard */
.welcome-section {
    padding: 28px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(255, 111, 97, 0.14), rgba(14, 165, 233, 0.12));
    border: 1px solid rgba(255, 111, 97, 0.18);
    box-shadow: var(--shadow-soft);
    margin-bottom: 28px;
}

.welcome-title {
    font-size: 2.2rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.welcome-subtitle {
    color: var(--muted-strong);
    font-weight: 600;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.dashboard-card {
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.card-clickable {
    cursor: pointer;
    position: relative;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card-clickable:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-strong);
    border-color: rgba(255, 111, 97, 0.3);
}

.card-clickable:active {
    transform: translateY(-3px);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 111, 97, 0.16), rgba(14, 165, 233, 0.14));
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.dashboard-card h3 {
    margin-bottom: 6px;
}

.dashboard-card p {
    color: var(--muted);
    margin-bottom: 12px;
}

.love-quote {
    margin-top: 32px;
    padding: 22px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px dashed var(--border);
    color: var(--muted-strong);
    font-style: italic;
    box-shadow: var(--shadow-soft);
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
}

.section-subtitle {
    color: var(--muted);
    font-weight: 600;
    margin: 0;
}

/* Search + Filters */
.search-container {
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    margin-bottom: 18px;
}

.search-box {
    position: relative;
    margin-bottom: 12px;
}

.search-box input {
    width: 100%;
    padding: 12px 40px 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 111, 97, 0.15);
}

.clear-search {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
}

.filter-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
}

.search-stats {
    color: var(--muted);
    font-weight: 600;
    margin-top: 8px;
}

/* Timeline / Memories */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.memory-card {
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.memory-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.memory-header h3 {
    font-size: 1.2rem;
}

.memory-date {
    color: var(--muted);
    font-weight: 600;
}

.memory-description {
    color: var(--muted-strong);
    margin: 8px 0 12px;
}

.memory-photos {
    margin: 12px 0 4px;
}

.photo-count-badge {
    background: rgba(14, 165, 233, 0.12);
    color: var(--muted-strong);
    padding: 6px 10px;
    border-radius: 10px;
    font-weight: 700;
}

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

.photo-thumbnail {
    position: relative;
    padding-top: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

.photo-thumbnail img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-thumbnail:hover {
    box-shadow: var(--shadow-soft);
}

.photo-more {
    display: grid;
    place-items: center;
    font-weight: 800;
    color: var(--ink);
    background: linear-gradient(135deg, rgba(255, 111, 97, 0.2), rgba(14, 165, 233, 0.18));
}

.memory-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.memory-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.album-badge,
.location-badge {
    background: rgba(15, 23, 42, 0.06);
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--muted-strong);
    font-weight: 700;
}

.memory-actions {
    display: flex;
    gap: 8px;
}

.empty-state {
    text-align: center;
    padding: 32px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

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

.album-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.album-cover,
.album-cover-placeholder {
    position: relative;
    padding-top: 68%;
    background: linear-gradient(135deg, rgba(255, 111, 97, 0.15), rgba(14, 165, 233, 0.18));
}

.album-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.album-icon {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 2.5rem;
    color: #fff;
}

.album-info {
    padding: 16px;
}

.album-description {
    color: var(--muted);
    margin: 8px 0 12px;
}

.album-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-weight: 600;
}

.album-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.album-detail-card,
.memory-detail-card {
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.album-detail-header,
.memory-detail-header {
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.album-meta-info,
.memory-meta-info {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-weight: 700;
}

.memory-location {
    margin: 14px 0;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--surface-alt);
    border: 1px solid var(--border);
}

.memory-photos-detail {
    margin-top: 16px;
}

.album-description.block {
    border-left: 4px solid var(--primary);
    padding-left: 14px;
    background: var(--surface-alt);
}

.memories-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.memory-item-card {
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-alt);
}

.memory-item-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-weight: 600;
}

.album-all-photos {
    margin-top: 24px;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
    background: var(--surface);
}

.photo-grid-detail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
#album-photos-grid > div {
    display: contents;
}

.photo-item-detail {
    position: relative;
    padding-top: 100%;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    cursor: pointer;
}

.photo-item-detail img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.05), rgba(15, 23, 42, 0.35));
    opacity: 0;
    transition: opacity var(--transition);
}

.photo-item-detail:hover .photo-overlay {
    opacity: 1;
}

.photo-action-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #fff;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
}

.photo-memory-badge {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transition: opacity var(--transition);
}

.photo-item-detail:hover .photo-memory-badge {
    opacity: 1;
}

/* Activities */
.activities-section {
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.activity-card {
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-alt);
}

.activity-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-weight: 600;
}

.pill {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-weight: 700;
}

.status {
    text-transform: capitalize;
}

.status-planned {
    background: rgba(14, 165, 233, 0.14);
    color: #0369a1;
    border-color: rgba(14, 165, 233, 0.4);
}

.status-completed {
    background: rgba(34, 197, 94, 0.14);
    color: #166534;
    border-color: rgba(34, 197, 94, 0.4);
}

.status-cancelled {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.4);
}

/* Location Search */
.location-search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.location-search-box .location-search-input {
    flex: 1;
}

.location-hint {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 8px 0 0 0;
}

/* Upload */
.upload-area {
    padding: 40px 28px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-alt);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary);
    background: rgba(255, 111, 97, 0.06);
    box-shadow: var(--shadow-soft);
}

.upload-content {
    color: var(--muted-strong);
    font-weight: 700;
}

.upload-content p {
    margin: 8px 0;
}

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

.upload-hint {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 4px;
}

.photo-preview {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.preview-item {
    position: relative;
    padding-top: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.preview-item img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-preview {
    position: absolute;
    top: 6px;
    right: 6px;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    cursor: pointer;
}

/* Map */
.map-container,
.location-map {
    width: 100%;
    height: 450px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    margin-top: 16px;
}

.location-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 16px 0;
}

.location-info {
    padding: 18px;
    border-radius: 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--muted-strong);
    margin-top: 16px;
}

.permission-hint {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    padding: 10px 12px;
    color: #9a3412;
    font-weight: 600;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 26, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 20px;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 16px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.lightbox-info {
    background: var(--surface);
    padding: 14px;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    text-align: center;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.lightbox-close {
    top: 24px;
    right: 24px;
}

.lightbox-prev {
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}

/* Modal */
.modal,
.confirm-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.modal-content,
.confirm-modal-content {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-strong);
    width: min(520px, 92vw);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--muted-strong);
}

.confirm-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    margin-top: 22px;
}

.pagination-btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--ink);
    font-weight: 700;
}

.pagination-btn:hover {
    border-color: var(--primary);
}

.pagination-info {
    color: var(--muted);
    font-weight: 700;
}

/* Responsive */
@media (max-width: 900px) {
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 320px;
        height: 100vh;
        background: var(--surface);
        border-left: 1px solid var(--border);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.08);
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 24px;
        gap: 12px;
        transition: right var(--transition);
    }

    .nav-menu.active {
        right: 0;
    }

    .hamburger {
        display: flex;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-brand {
        max-width: 70%;
    }

    .memory-header,
    .memory-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions .btn,
    .memory-actions .btn,
    .album-actions .btn {
        width: 100%;
    }

    .map-container,
    .location-map {
        height: 400px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-actions {
        margin-top: 24px;
        padding-top: 20px;
    }
}

@media (max-width: 540px) {
    .main-content {
        padding: 12px 0 16px;
    }

    .welcome-title {
        font-size: 1.7rem;
    }

    .dashboard-grid,
    .albums-grid,
    .activity-grid {
        grid-template-columns: 1fr;
    }

    .form-container,
    .form-container-spacious,
    .activities-section,
    .album-detail-card,
    .memory-detail-card {
        padding: 24px 20px;
    }
    
    .form-container-spacious {
        padding: 24px 18px;
    }

    .btn {
        width: 100%;
    }

    .pagination {
        flex-direction: column;
    }

    .container { 
        padding: 0 12px; 
    }
    .nav-container { 
        padding: 12px 12px; 
    }
    .nav-brand { 
        font-size: 1.2rem; 
        max-width: 65%; 
    }
    .page-header { 
        margin-bottom: 10px; 
    }
    .page-header h1 { 
        font-size: 1.3rem; 
    }
    .form-group input,
    .form-group textarea,
    .form-group select { 
        font-size: 1rem;
        padding: 12px 14px;
    }
    
    .location-search-box {
        flex-direction: column;
        gap: 10px;
    }
    
    .location-search-box .btn {
        width: 100%;
    }

    .upload-area {
        padding: 32px 20px;
    }
    .dashboard-card,
    .album-card,
    .activity-card,
    .memory-card,
    .form-container,
    .activities-section {
        width: 100%;
    }
    .messages-wrapper { 
        height: calc(100vh - 140px);
        max-height: calc(100vh - 140px);
        padding: 10px;
        gap: 8px;
    }
    .message-list { 
        padding: 6px;
        gap: 6px;
    }
    .message-form { 
        gap: 5px;
        padding-top: 2px;
    }
    .message-form textarea {
        min-height: 50px;
        max-height: 100px;
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    .chat-floating { 
        position: relative; 
        width: 100%; 
        max-width: 100%;
        max-height: none; 
        right: auto; 
        bottom: auto; 
    }
    .message-item {
        max-width: 92%;
        padding: 8px 10px;
    }
    .message-meta {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }
    .message-attachment img {
        max-width: 100%;
    }
    .message-attachment video,
    .message-attachment audio {
        max-width: 100%;
    }
    .attachment-row {
        gap: 6px;
    }
    .attach-btn {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    .btn-small {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .split {
        grid-template-columns: 1fr;
    }
    #chatCard {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 50vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        z-index: 100;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
    }
    #chatMessages {
        max-height: 200px;
    }
}



.album-actions .btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    min-width: auto;
}

/* Messages */
.messages-wrapper {
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: calc(100vh - 200px);
    max-height: calc(100vh - 200px);
    width: 100%;
    max-width: 100%;
}

.message-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--surface-alt);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    min-height: 0;
}

.message-item {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.message-item.from-me {
    margin-left: auto;
    background: linear-gradient(135deg, rgba(255, 111, 97, 0.16), rgba(14, 165, 233, 0.16));
}

.message-item.from-them {
    margin-right: auto;
    background: #fff;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.message-item p {
    margin: 0;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-word;
}

.message-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    background: var(--surface);
    padding-top: 4px;
}

.message-form textarea {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 10px 12px;
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
    font-family: 'Manrope', sans-serif;
    font-size: 0.95rem;
}

.message-actions {
    display: flex;
    justify-content: flex-end;
}

.message-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}

.message-status {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.message-status.deleted {
    color: #b91c1c;
    font-weight: 700;
}

.chat-floating {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    max-height: none;
    z-index: 1;
}

.inline-toast {
    position: fixed;
    bottom: 90px;
    right: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-strong);
    padding: 12px 14px;
    border-radius: 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    font-weight: 700;
}

.inline-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.message-attachment {
    margin-top: 8px;
}

.message-attachment img {
    max-width: 220px;
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
}

.message-attachment video,
.message-attachment audio {
    max-width: 260px;
    width: 100%;
    border-radius: 10px;
}

.attachment-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
    background: var(--surface-alt);
    cursor: pointer;
    font-weight: 700;
}

.attach-btn input {
    display: none;
}

.attachment-name {
    color: var(--muted-strong);
    font-weight: 600;
}

.seen-indicator {
    text-align: right;
    color: var(--muted);
    font-weight: 700;
    margin-top: 6px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Videos */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

@media (max-width: 768px) {
    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .videos-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .video-thumbnail video {
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    .video-overlay {
        opacity: 1; /* Always show on mobile */
    }
}

.video-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-strong);
    border-color: rgba(255, 111, 97, 0.25);
}

.video-thumbnail {
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    overflow: hidden;
}

.video-thumbnail video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity var(--transition);
}

.video-card:hover .video-overlay {
    opacity: 1;
}

.video-info {
    padding: 16px;
}

.video-info h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.video-description {
    color: var(--muted);
    margin: 8px 0 10px;
    font-size: 0.9rem;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.video-actions {
    display: flex;
    gap: 8px;
}

.video-player-container {
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.video-player-container video {
    width: 100%;
    height: auto;
    display: block;
}

.video-duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
}

/* Chat Panel */
#chatCard {
    transition: all var(--transition);
}

#chatMessages {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

#chatMessages::-webkit-scrollbar {
    width: 6px;
}

#chatMessages::-webkit-scrollbar-track {
    background: transparent;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* User List */
#userListContainer {
    animation: fadeIn 0.3s ease;
}

#userList .badge {
    transition: transform var(--transition);
}

#userList .badge:hover {
    transform: scale(1.05);
}

/* Sync Indicator */
#syncIndicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all var(--transition);
}

#syncIndicator.pulse {
    animation: pulse 1s ease-in-out infinite;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Mobile adjustments */
@media (max-width: 900px) {
    .nav-container { 
        padding: 12px 16px; 
    }
    .nav-brand { 
        max-width: 70%; 
    }
    .chat-floating { 
        position: relative; 
        bottom: auto; 
        right: auto; 
        width: 100%; 
        max-width: 100%;
        max-height: none; 
    }
    .messages-wrapper {
        padding: 12px;
        height: calc(100vh - 180px);
        max-height: calc(100vh - 180px);
    }
    .main-content {
        padding: 16px 0 20px;
    }
    .page-header {
        margin-bottom: 12px;
    }
}
