:root {
    /* Color Palette - Premium Monochrome */
    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --accent-color: #000000;
    --accent-hover: #333333;
    --border-color: #e9ecef;
    --error-color: #dc3545;
    --success-color: #28a745;
    
    /* Shadows & Effects */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 24px rgba(0,0,0,0.12);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-blur: blur(10px);
    
    /* Spacing & Radii */
    --container-width: 1200px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Dynamic Props */
    --thumb-size: 200px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

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

button, input, select, textarea {
    font-family: inherit;
}

/* Header */
.main-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.logo img {
    height: 32px;
    width: auto;
}

.main-nav {
    display: flex;
    gap: 8px;
}

.main-nav a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--text-primary);
    background: var(--border-color);
}

/* User Chip */
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.user-chip:hover {
    box-shadow: var(--shadow-sm);
}

.user-chip img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    font-weight: 600;
}

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 101;
}

.user-email-text {
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background: var(--bg-color);
}

.menu-item.danger {
    color: var(--error-color);
}

/* Views */
.view {
    display: none;
    padding: 40px 0;
    animation: fadeIn 0.4s ease-out;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.button.primary {
    background: var(--accent-color);
    color: white;
}

.button.primary:hover {
    background: var(--accent-hover);
}

.button.secondary {
    background: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.button.ghost {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.button.ghost:hover {
    background: var(--border-color);
}

.button.subtle {
    background: #f1f3f5;
    color: var(--text-primary);
}

.button.large {
    padding: 14px 28px;
    font-size: 1.1rem;
}

.button.full-width {
    width: 100%;
}

.button.google-btn {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 100%;
    margin-top: 16px;
}

/* Cards */
.card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

input[type="text"], input[type="url"], input[type="password"], textarea, select {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.input-with-button {
    display: flex;
    gap: 8px;
}

/* Create View Specifics */
.create-hero {
    text-align: center;
    margin-bottom: 40px;
}

.create-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.create-form {
    max-width: 600px;
    margin: 0 auto;
}

/* Gallery View Specifics */
.gallery-intro {
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-lg);
    padding: 100px 40px;
    margin-bottom: 32px;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.gallery-intro::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.3) 100%);
    z-index: 1;
}

.gallery-intro-content {
    position: relative;
    z-index: 2;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 12px;
    display: block;
    opacity: 0.8;
}

.gallery-tools-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    position: sticky;
    top: 80px;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Photo Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--thumb-size), 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.photo-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    background: #eee;
    transition: transform 0.2s;
}

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

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}

.photo-card .caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 20px 12px 8px;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-card:hover .caption {
    opacity: 1;
}

.heart-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #ccc;
    z-index: 10;
}

.heart-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.heart-btn[aria-pressed="true"] {
    color: var(--error-color);
    background: white;
}

.photo-card.selected {
    outline: 3px solid var(--accent-color);
    outline-offset: -3px;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.lightbox-overlay[hidden], .modal-overlay[hidden], [hidden] {
    display: none !important;
}

.lightbox-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#lightbox-image {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    transition: transform 0.1s ease-out;
}

.lightbox-btn {
    position: absolute;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 20px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.lightbox-btn:hover {
    opacity: 1;
}

.lightbox-btn.close { top: 20px; right: 20px; font-size: 2.5rem; line-height: 1; }
.lightbox-btn.prev { left: 20px; }
.lightbox-btn.next { right: 20px; }

.lightbox-actions {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
}

.lightbox-action-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.lightbox-action-btn:hover {
    background: rgba(255,255,255,0.3);
}

.lightbox-action-btn.heart.is-selected {
    background: var(--error-color);
}

.lightbox-caption {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-color);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    z-index: 2000;
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stats-grid div {
    background: var(--surface-color);
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stats-grid strong {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.stats-grid span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Album Grid & Cards */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.album-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.album-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.album-cover {
    height: 180px;
    background-color: #eee;
    background-size: cover;
    background-position: center;
    position: relative;
}

.album-body {
    padding: 20px;
}

.album-body h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-stats {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tag-lock {
    background: #fff3cd;
    color: #856404;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

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

/* Admin Specific */
.admin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

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

.admin-row small {
    display: block;
    color: var(--text-secondary);
}

.user-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-row .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.cover-preview {
    width: 100%;
    height: 150px;
    background-color: #eee;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Overlay Fix */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-card {
    background: var(--surface-color);
    width: 95%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    background: var(--bg-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
