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

:root {
    --bg-primary: #000;
    --bg-secondary: #1c1c1e;
    --text-primary: #fff;
    --text-secondary: #8e8e93;
    --accent: #0a84ff;
    --border: #38383a;
    --header-height: 50px;
    --tabs-height: 0px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
}

/* Screens */
.screen {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Login Screen */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    text-align: center;
    padding: 40px;
    max-width: 400px;
    width: 100%;
}

.login-container h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-container p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#login-form input {
    padding: 16px;
    border-radius: 12px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px;
}

#login-form input::placeholder {
    color: var(--text-secondary);
}

#login-form button {
    padding: 16px;
    border-radius: 12px;
    border: none;
    background: var(--accent);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

#login-form button:hover {
    opacity: 0.8;
}

.error {
    color: #ff453a;
    margin-top: 16px;
    font-size: 14px;
}

/* Gallery Header */
.gallery-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

/* Selection Bar (replaces header in selection mode) */
.selection-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    z-index: 101;
    border-bottom: 1px solid var(--border);
}

.selection-bar.hidden {
    display: none;
}

.selection-bar-btn {
    width: 32px;
    height: 32px;
    padding: 5px;
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
}

.selection-bar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.selection-bar-btn svg {
    width: 20px;
    height: 20px;
}

.selection-count {
    color: var(--accent);
    font-size: 16px;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.selection-bar-actions {
    display: flex;
    gap: 2px;
}

.gallery-header h1 {
    font-size: 28px;
    font-weight: 700;
    display: none;
}

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

.header-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 16px;
    cursor: pointer;
}

.header-btn.icon-btn {
    width: 32px;
    height: 32px;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.header-btn.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-btn.icon-btn svg {
    width: 20px;
    height: 20px;
}

/* Gallery Tabs (now inline in header) */
.gallery-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
}

.tab {
    width: 36px;
    height: 36px;
    padding: 7px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.tab.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Gallery Grid */
.gallery-grid {
    padding-top: calc(var(--header-height) + 8px);
    padding-bottom: 32px;
}

/* When calendar switcher is visible, gallery-grid doesn't need header padding */
.calendar-mode-switcher:not(.hidden) + .gallery-grid {
    padding-top: 8px;
}

/* Virtual Scroll Container */
.virtual-scroll-container {
    position: relative;
    width: 100%;
}

.virtual-scroll-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

/* Date Section */
.date-section {
    margin-bottom: 24px;
}

.date-header {
    padding: 8px 16px;
    font-size: 20px;
    font-weight: 600;
    position: sticky;
    top: var(--header-height);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    z-index: 50;
}

.photos-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 2px;
    padding: 0 2px;
}

@media (min-width: 768px) {
    .photos-row {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (min-width: 1200px) {
    .photos-row {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

/* Photo Thumbnail */
.photo-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: var(--bg-secondary);
    /* Prevent browser long-press behaviors (context menu, callout, etc.) */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s, opacity 0.3s;
    opacity: 0;
}

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

.photo-thumb:hover img {
    transform: scale(1.05);
}

/* Video indicator overlay */
.video-indicator {
    position: absolute;
    bottom: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.video-indicator::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent white;
    margin-left: 2px;
}

/* Favorite indicator overlay */
.favorite-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    pointer-events: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.favorite-indicator svg {
    width: 100%;
    height: 100%;
    fill: #ff375f;
}

/* Selection circle for selection mode */
.selection-circle {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border: 2px solid white;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: background-color 0.15s, border-color 0.15s;
}

.selection-circle.selected {
    background: #007aff;
    border-color: #007aff;
}

.selection-circle.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.photo-thumb.selected {
    outline: 3px solid #007aff;
    outline-offset: -3px;
}

/* Selection mode cursor */
#gallery-content.selection-mode .photo-thumb {
    cursor: pointer;
}

/* Loading */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 200;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-secondary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Photo Viewer Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Photo viewer animation */
#photo-viewer {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.25s ease, transform 0.25s ease;
    touch-action: manipulation; /* Disable double-tap zoom on iOS */
}

#photo-viewer.hidden {
    display: none !important;
}

#photo-viewer.animating {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

.close-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.pcloud-link-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    text-decoration: none;
    transition: background 0.2s;
}

.pcloud-link-btn:hover {
    background: var(--accent-color);
}

/* Download button in viewer */
.download-btn {
    position: absolute;
    top: 16px;
    left: 114px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.download-btn svg {
    width: 22px;
    height: 22px;
}

.download-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.download-btn.downloading {
    animation: pulse 1s infinite;
}

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

/* Favorite button in viewer */
.favorite-btn {
    position: absolute;
    top: 16px;
    right: 70px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s, color 0.2s;
}

.favorite-btn svg {
    width: 24px;
    height: 24px;
}

.favorite-btn .heart-filled {
    display: none;
}

.favorite-btn .heart-outline {
    display: block;
}

.favorite-btn.is-favorite {
    color: #ff375f;
}

.favorite-btn.is-favorite .heart-filled {
    display: block;
}

.favorite-btn.is-favorite .heart-outline {
    display: none;
}

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

/* Favorite indicator on thumbnails */
.photo-thumb .favorite-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    color: #ff375f;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
    pointer-events: none;
}

.nav-btn {
    position: absolute;
    top: 0;
    width: 20%;
    height: 100%;
    border: none;
    background: transparent;
    color: transparent;
    cursor: pointer;
    z-index: 5;
}

.nav-btn.prev {
    left: 0;
}

.nav-btn.next {
    right: 0;
}

.nav-btn:hover {
    background: transparent;
}

.photo-container {
    width: 98vw;
    height: 94vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.photo-container img {
    max-width: 100%;
    max-height: 94vh;
    object-fit: contain;
    transition: filter 0.2s ease, width 0.2s ease, height 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

/* Navigation slide animations */
.photo-container img.slide-out-left {
    transform: translateX(-50px);
    opacity: 0;
}

.photo-container img.slide-out-right {
    transform: translateX(50px);
    opacity: 0;
}

.photo-container img.slide-in-left {
    transform: translateX(50px);
    opacity: 0;
    transition: none;
}

.photo-container img.slide-in-right {
    transform: translateX(-50px);
    opacity: 0;
    transition: none;
}

/* Video play overlay in viewer */
.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.3);
    transition: background 0.2s;
}

.video-play-overlay:hover {
    background: rgba(0, 0, 0, 0.4);
}

.video-play-overlay .play-circle {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.video-play-overlay:hover .play-circle {
    transform: scale(1.1);
}

.video-play-overlay .play-triangle {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 15px 0 15px 25px;
    border-color: transparent transparent transparent #333;
    margin-left: 5px;
}

/* Video player in viewer */
.photo-container video {
    max-width: 100%;
    max-height: 94vh;
    object-fit: contain;
    background: #000;
}

.photo-container video.hidden {
    display: none;
}

/* Loading indicator for video */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-loading .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.photo-info {
    position: absolute;
    bottom: 12px;
    text-align: center;
}

.photo-info p:first-child {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.photo-info p:nth-child(2) {
    font-size: 14px;
    color: var(--text-secondary);
}

.info-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    z-index: 1001;
}

.info-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.info-btn.active {
    background: var(--accent-color);
}

.info-btn svg {
    width: 24px;
    height: 24px;
}

/* Viewer selection button */
.viewer-selection-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    z-index: 1001;
}

.viewer-selection-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.viewer-selection-circle {
    width: 24px;
    height: 24px;
    border: 2px solid white;
    border-radius: 50%;
    background: transparent;
    transition: background-color 0.15s, border-color 0.15s;
}

.viewer-selection-circle.selected {
    background: #007aff;
    border-color: #007aff;
}

.viewer-selection-circle.selected::after {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Photo Info Modal */
#photo-info-modal {
    z-index: 1100;
}

.photo-info-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.photo-info-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.photo-info-header .close-btn {
    position: static;
    width: 32px;
    height: 32px;
    font-size: 20px;
}

.photo-info-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.info-section {
    margin-bottom: 20px;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

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

.info-label {
    font-size: 14px;
    color: var(--text-secondary);
    min-width: 100px;
    flex-shrink: 0;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
    max-width: 280px;
}

/* Calendar Mode Switcher */
.calendar-mode-switcher {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    margin-top: var(--header-height);
    background: var(--bg-primary);
    position: relative;
    z-index: 50;
    margin-bottom: -55px; /* Avoid extra margin of the gallery */
}

.calendar-mode-switcher.hidden {
    display: none;
}

.calendar-mode-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.calendar-mode-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.calendar-mode-btn.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Memories Date Picker */
.memories-date-picker {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    margin-top: var(--header-height);
    background: var(--bg-primary);
}

.memories-date-picker.hidden {
    display: none;
}

.memories-date-input {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color-scheme: dark;
}

.memories-date-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.memories-date-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.memories-date-arrow:hover {
    background: var(--bg-tertiary);
}

.memories-date-arrow:active {
    transform: scale(0.95);
}

.memories-date-arrow svg {
    width: 20px;
    height: 20px;
}

/* When memories date picker is visible, gallery-grid doesn't need header padding */
.memories-date-picker:not(.hidden) + .gallery-grid {
    padding-top: 8px;
}

/* Months/Years View */
.month-group, .year-group {
    margin-bottom: 32px;
}

.month-header, .year-header {
    padding: 16px;
    font-size: 24px;
    font-weight: 700;
}

.month-header .count, .year-header .count {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
}

/* Virtual scroll section headers */
.section-header {
    display: flex;
    align-items: center;
    padding: 0 8px;
    background: var(--bg-primary);
}

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

.section-header .count {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 8px;
}

.section-header .expand-icon {
    font-size: 14px;
    margin-right: 8px;
    color: var(--accent);
    transition: transform 0.2s;
}

.section-header:hover {
    background: var(--bg-secondary);
}

.month-preview, .year-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0 2px;
}

.month-preview .photo-thumb,
.year-preview .photo-thumb {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--text-secondary);
}

.empty-state h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 16px;
}

/* Folder Picker Modal */
#folder-picker {
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-picker-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.folder-picker-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.folder-picker-header .close-btn {
    position: static;
    width: 32px;
    height: 32px;
    font-size: 20px;
}

.folder-picker-info {
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.folder-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.folder-tree-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.folder-item {
    display: flex;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.folder-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.folder-expand {
    width: 20px;
    font-size: 10px;
    color: var(--text-secondary);
    cursor: pointer;
}

.folder-expand.no-children {
    visibility: hidden;
}

.folder-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    margin-right: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.folder-checkbox.checked {
    background: var(--accent);
    border-color: var(--accent);
}

.folder-checkbox.checked::after {
    content: '\2713';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.folder-shared-icon {
    margin-right: 4px;
    font-size: 14px;
    opacity: 0.8;
}

.folder-name {
    flex: 1;
    font-size: 16px;
    cursor: pointer;
}

.folder-children {
    display: block;
}

.folder-picker-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.btn-primary {
    padding: 12px 32px;
    border-radius: 12px;
    border: none;
    background: var(--accent);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.8;
}

/* Profiles Modal */
.profiles-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    max-width: 500px;
    max-height: 80vh;
    width: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.profiles-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.profiles-header .close-btn {
    position: static;
    width: 32px;
    height: 32px;
    font-size: 20px;
}

.profiles-info {
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.profiles-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

.profile-item.active {
    background: rgba(10, 132, 255, 0.1);
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-name {
    font-size: 16px;
    font-weight: 500;
}

.profile-folders {
    font-size: 12px;
    color: var(--text-secondary);
}

.profile-actions-btns {
    display: flex;
    gap: 8px;
    align-items: center;
}

.profile-active-badge {
    padding: 4px 10px;
    background: var(--accent);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.profile-select-btn,
.profile-rename-btn,
.profile-delete-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.profile-select-btn {
    background: var(--accent);
    color: white;
}

.profile-rename-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.profile-delete-btn {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
}

.profile-select-btn:hover,
.profile-rename-btn:hover,
.profile-delete-btn:hover {
    opacity: 0.8;
}

.profiles-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.btn-secondary {
    padding: 12px 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Albums Modal */
.albums-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    max-width: 500px;
    max-height: 80vh;
    width: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.albums-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.albums-header .close-btn {
    position: static;
    width: 32px;
    height: 32px;
    font-size: 20px;
}

.albums-info {
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.albums-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    min-height: 200px;
}

.album-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

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

.album-item.active {
    background: rgba(10, 132, 255, 0.1);
}

.album-info {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
}

.album-info .album-shortcut {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 24px;
}

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

.album-count {
    font-size: 12px;
    color: var(--text-secondary);
    width: 100%;
    margin-left: 32px;
}

.album-actions-btns {
    display: flex;
    gap: 8px;
    align-items: center;
}

.album-delete-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
}

.album-delete-btn:hover {
    opacity: 0.8;
}

.album-rename-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
    background: rgba(10, 132, 255, 0.2);
    color: var(--accent);
}

.album-rename-btn:hover {
    opacity: 0.8;
}

.albums-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.albums-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

/* Album Picker Modal (Add to Album) */
#album-picker {
    z-index: 1100;
}

.album-picker-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    max-width: 400px;
    max-height: 60vh;
    width: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.album-picker-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.album-picker-header .close-btn {
    position: static;
    width: 32px;
    height: 32px;
    font-size: 20px;
}

.album-picker-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    min-height: 150px;
}

.album-picker-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
    gap: 10px;
}

.album-picker-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.album-picker-item.in-album {
    background: rgba(10, 132, 255, 0.1);
}

.album-picker-item .album-shortcut {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 24px;
    flex-shrink: 0;
}

.album-picker-item .album-name {
    font-size: 15px;
    flex: 1;
}

.album-picker-item .checkmark-icon {
    width: 20px;
    height: 20px;
    color: var(--accent);
    flex-shrink: 0;
}

.album-picker-loading {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.album-picker-actions {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

.album-picker-empty {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Album button in viewer */
.album-btn {
    position: absolute;
    top: 16px;
    left: 60px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.album-btn svg {
    width: 22px;
    height: 22px;
}

.album-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}
