:root {
    --bg-color: #1e1e1e;
    --sidebar-bg: rgba(30, 30, 30, 0.95);
    --main-bg: #000000;
    --text-primary: #ffffff;
    --text-secondary: #a1a1a6;
    --accent-color: #0a84ff;
    --border-color: #38383a;
    --scrim-color: rgba(0, 0, 0, 0.4);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--main-bg);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    font-size: 14px;
}

/* Login Screen */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: radial-gradient(circle at center, #2d2d2d 0%, #000000 100%);
}

.login-box {
    background: rgba(40, 40, 40, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 18px;
    border: var(--glass-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    width: 340px;
    text-align: center;
    transition: transform 0.3s ease;
}

.login-box h1 {
    margin-bottom: 24px;
    font-weight: 500;
    font-size: 24px;
}

.input-group {
    margin-bottom: 16px;
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    border-radius: 10px;
    color: white;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
}

.input-group input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.3);
}

.login-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.login-btn:hover {
    background-color: #0077ed;
}

/* Main App Layout */
.app-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    height: 100%;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 10px;
    backdrop-filter: blur(10px);
}

.sidebar-title {
    padding: 0 14px;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
}

.nav-item i {
    width: 24px;
    font-size: 16px;
    margin-right: 8px;
    color: var(--accent-color);
}

.logout-btn {
    margin-top: auto;
}

.logout-btn:hover {
    color: #ff3b30;
    background: rgba(255, 59, 48, 0.1);
}

.logout-btn:hover i {
    color: #ff3b30;
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    background-color: var(--main-bg);
    padding: 24px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.content-title {
    font-size: 28px;
    font-weight: 700;
}

.refresh-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-color);
    transition: transform 0.2s;
}

.photo-item:hover {
    transform: scale(1.02);
}

.play-icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-item img.loaded {
    opacity: 1;
}

/* Lightbox / Fullscreen Viewer */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    opacity: 0;
}

.lightbox-media:hover .nav-arrow {
    opacity: 1;
}

.nav-arrow:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.nav-arrow.left {
    left: 20px;
}

.nav-arrow.right {
    right: 20px;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    cursor: grab;
    transform-origin: center;
}

.lightbox video {
    cursor: grab;
    transform-origin: center;
}

.lightbox img:active,
.lightbox video:active {
    cursor: grabbing;
}

.lightbox-content {
    display: flex;
    width: 95%;
    height: 95%;
    gap: 20px;
}

.lightbox-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 0;
    /* Fix flex overflow */
}

.lightbox-sidebar {
    width: 300px;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.meta-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    word-break: break-word;
}

.meta-row {
    margin-bottom: 16px;
}

.meta-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-value {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}


.close-help {
    position: absolute;
    top: 20px;
    right: 20px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
}

/* File Explorer (List View) */
.file-explorer {
    display: flex;
    flex-direction: column;
}

.fe-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.fe-breadcrumbs {
    flex: 1;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.fe-back-btn {
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-size: 16px;
    margin-right: 16px;
    cursor: pointer;
    font-weight: 500;
}

.fe-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fe-toolbar {
    display: flex;
    gap: 10px;
}

.fe-tool-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.fe-tool-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.fe-tool-btn.danger {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
}

.fe-tool-btn.danger:hover {
    background: rgba(255, 59, 48, 0.3);
}

.fe-sort-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    outline: none;
    transition: background 0.2s;
}

.fe-sort-select:hover {
    background: rgba(255, 255, 255, 0.15);
}

.fe-sort-select option {
    background: var(--bg-color);
    color: var(--text-primary);
}


.fe-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-color);
}

.fe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.fe-row {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.1s;
}

.fe-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.fe-row.selected {
    background: rgba(10, 132, 255, 0.15);
}

.fe-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    cursor: pointer;
}

.fe-checkbox.checked {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    font-size: 12px;
}

.fe-icon {
    width: 30px;
    font-size: 20px;
    margin-right: 14px;
    display: flex;
    justify-content: center;
}

.fe-name {
    flex: 1;
    font-size: 15px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fe-size {
    font-size: 13px;
    color: var(--text-secondary);
    width: 80px;
    text-align: right;
}

/* Grid Card */
.fe-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    background: rgba(255, 255, 255, 0.03);
}

.fe-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.fe-card.selected {
    background: rgba(10, 132, 255, 0.15);
    box-shadow: 0 0 0 2px var(--accent-color) inset;
}

.fe-card-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.fe-card-name {
    font-size: 13px;
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.fe-checkbox-overlay {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 12px;
}

.fe-checkbox-overlay:hover {
    background: rgba(0, 0, 0, 0.7);
}

.fe-checkbox-overlay.checked {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.fe-empty {
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Loading State */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* People Grid — Google Photos Style */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.person-card {
    position: relative;
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: #222;
    transition: transform 0.2s, box-shadow 0.2s;
}

.person-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.person-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.person-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
}

.person-card-placeholder i {
    font-size: 56px;
    color: var(--text-secondary);
}

.person-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 12px 12px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.person-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.person-card-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.person-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 59, 48, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    z-index: 20;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: auto;
}

.person-delete-btn:hover {
    transform: scale(1.1);
    background: #d70015;
}

.person-card:hover .person-delete-btn {
    opacity: 1;
}

/* Person Detail View */
.person-detail-view {
    display: flex;
    flex-direction: column;
}

.person-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.person-detail-name {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    padding: 4px 8px;
    border-radius: 6px;
    outline: none;
    transition: background 0.2s;
    cursor: text;
}

.person-detail-name:focus {
    background: rgba(255, 255, 255, 0.1);
}

.person-detail-count {
    font-size: 14px;
    color: var(--text-secondary);
    margin-left: auto;
}

.person-detail-delete {
    background: rgba(255, 59, 48, 0.15);
    color: #ff3b30;
    border: 1px solid rgba(255, 59, 48, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.person-detail-delete:hover {
    background: rgba(255, 59, 48, 0.25);
    border-color: #ff3b30;
}

/* Search Interface */
.search-interface {
    display: flex;
    flex-direction: column;
}

.search-controls {
    margin-bottom: 24px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.search-people-select {
    margin-bottom: 16px;
}

.search-people-select h4 {
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text-secondary);
}

.people-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.person-chip {
    padding: 6px 12px;
    background: #333;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.person-chip:hover {
    background: #444;
}

.person-chip.selected {
    background: var(--accent-color);
    color: white;
}

.search-box-row {
    display: flex;
    gap: 10px;
}

.search-box-row input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    background: #333;
    color: white;
    outline: none;
}

search-box-row button {
    padding: 0 20px;
    border-radius: 8px;
    border: none;
    background: var(--accent-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

/* Timeline View */
/* Photo Search Bar */
.photo-search-bar {
    display: flex;
    align-items: center;
    background: #2a2a2e;
    border-radius: 24px;
    padding: 0 16px;
    margin-bottom: 20px;
    transition: background 0.2s, box-shadow 0.2s;
    position: relative;
}

.photo-search-bar:focus-within {
    background: #333338;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.photo-search-icon {
    color: var(--text-secondary);
    font-size: 15px;
    flex-shrink: 0;
}

.photo-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    padding: 12px;
    font-family: inherit;
}

.photo-search-input::placeholder {
    color: var(--text-secondary);
}

.photo-search-clear {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.photo-search-clear:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.timeline-view {
    display: flex;
    flex-direction: column;
}

.timeline-section {
    margin-bottom: 40px;
}

.timeline-date-header {
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-date-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.timeline-date-header span {
    font-size: 14px;
    color: var(--text-secondary);
}

.timeline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

/* Discover View */
.discover-view {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.memory-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
}

.memory-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.memory-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.memory-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    margin-top: 4px;
}

.header-action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* Album Button Overlay */
.album-btn {
    display: flex;
    flex-direction: column;
}

/* Albums View */
.albums-view {
    display: flex;
    flex-direction: column;
}

.albums-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.albums-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

.create-album-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.create-album-btn:hover {
    background: #0077ed;
}

.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.album-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    position: relative;
}

.album-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.08);
}

.album-cover {
    aspect-ratio: 1;
    background: var(--bg-color);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--text-secondary);
}

.album-info {
    padding: 16px;
}

.album-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.album-badge {
    display: inline-block;
    background: rgba(10, 132, 255, 0.2);
    color: var(--accent-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
}

.album-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 59, 48, 0.9);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 5;
}

.album-card:hover .album-delete-btn {
    opacity: 1;
}

.album-delete-btn:hover {
    transform: scale(1.1);
    background: #d70015;
}

.album-detail-view {
    display: flex;
    flex-direction: column;
}

.album-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.album-detail-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

    /* Login Screen */
    .login-box {
        width: 90%;
        max-width: 340px;
        padding: 30px 20px;
    }

    /* Main Layout */
    .app-layout {
        flex-direction: column;
    }

    /* Sidebar -> Bottom Navigation */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-color);
        padding: 10px 20px;
        justify-content: space-around;
        z-index: 100;
        background-color: rgba(30, 30, 30, 0.98);
        /* Less transparent for bottom bar */
        padding-bottom: env(safe-area-inset-bottom, 20px);
        /* Handle iPhone Home Indicator */
    }

    .sidebar-title {
        display: none;
    }

    .nav-item {
        flex-direction: column;
        margin-bottom: 0;
        padding: 8px;
        font-size: 10px;
        text-align: center;
        background: transparent !important;
        /* Remove hover bg on mobile to avoid sticky hover states */
    }

    .logout-btn {
        margin-top: 0 !important;
        color: #ff3b30;
        /* Make it red on mobile too? Or just standard? */
        /* Let's keep standard color but allow hover state if tapped */
    }

    .nav-item.active {
        color: var(--accent-color);
    }

    .nav-item.active i {
        color: var(--accent-color);
    }

    .nav-item i {
        margin-right: 0;
        margin-bottom: 4px;
        font-size: 20px;
        display: block;
    }

    /* Content Area */
    .content-area {
        padding: 16px;
        padding-bottom: 90px;
        /* Space for bottom nav */
    }

    .content-header {
        margin-bottom: 16px;
    }

    .content-title {
        font-size: 24px;
    }

    /* Photo Grid */
    .photo-grid {
        /* Smaller thumbnails on mobile, e.g., 3 per row (screen width / 3 approx 100-120px) */
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
        gap: 2px;
        /* Tighter gap like native apps */
    }

    .photo-item {
        border-radius: 0;
        /* Square look or slight radius? Native uses square with tiny gap */
    }

    /* Lightbox */
    .lightbox img {
        max-width: 100%;
        max-height: 80%;
        /* Leave room for close button if needed, although it overlays */
    }

    .close-help {
        top: auto;
        bottom: 100px;
        /* Position above nav bar area if visible, or just safely bottom */
        right: 50%;
        transform: translateX(50%);
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
    }
}

/* Album Management */
.album-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    z-index: 5;
}

.photo-item:hover .album-btn {
    opacity: 1;
}

.album-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: scale(1.1);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

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

.modal {
    background: #2c2c2e;
    width: 400px;
    max-width: 90%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

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

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

.modal-body {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
}

.album-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.album-list-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.album-list-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.album-list-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 12px;
    background: #444;
}

.album-list-info {
    flex: 1;
}

.album-list-name {
    font-size: 14px;
    font-weight: 500;
}

.album-list-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.create-album-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.create-album-input-group {
    display: flex;
    gap: 10px;
}

.create-album-input-group input {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    outline: none;
}

.create-album-btn {
    padding: 0 16px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.create-album-btn:hover {
    background: #0077ed;
}

/* Video Overlay */
.play-icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}

/* Share Button Overlay (bottom-right, shown on hover) */
.share-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    z-index: 5;
    font-size: 13px;
}

.photo-item:hover .share-btn {
    opacity: 1;
}

.share-btn:hover {
    background: #34c759;
    border-color: #34c759;
    transform: scale(1.1);
}

/* Shared Badge (bottom-left, always visible for received photos) */
.shared-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(52, 199, 89, 0.85);
    color: white;
    font-size: 10px;
    font-weight: 600;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.shared-badge i {
    font-size: 9px;
}

/* Unshare Button (bottom-right, shown on hover for received photos) */
.unshare-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 59, 48, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    z-index: 5;
    font-size: 13px;
}

.photo-item:hover .unshare-btn {
    opacity: 1;
}

.unshare-btn:hover {
    background: #ff3b30;
    border-color: #ff3b30;
    transform: scale(1.1);
}

/* Shared-with indicator (shown on hover for owner's shared photos) */
.shared-indicator {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(10, 132, 255, 0.85);
    color: white;
    font-size: 10px;
    font-weight: 600;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    backdrop-filter: blur(4px);
}

.photo-item:hover .shared-indicator {
    opacity: 1;
}

/* Share Modal: User picker list */
.user-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.user-list-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
}

.user-list-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-list-item.selected {
    background: rgba(52, 199, 89, 0.15);
    box-shadow: 0 0 0 1px rgba(52, 199, 89, 0.5) inset;
}

.user-list-item .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.user-list-item .user-email {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-list-item .user-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: transparent;
    flex-shrink: 0;
}

.user-list-item.selected .user-check {
    background: #34c759;
    border-color: #34c759;
    color: white;
}

.share-submit-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #34c759;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.2s;
}

.share-submit-btn:hover {
    background: #2fb44e;
}

.share-submit-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #555;
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked+.toggle-slider {
    background: #34c759;
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

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

.modal {
    background: var(--card-bg, #1e1e2e);
    border-radius: 12px;
    width: 500px;
    max-width: 90vw;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

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

.modal-title {
    font-weight: 600;
    color: white;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 6px;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-body {
    padding: 20px;
}