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

:root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface-hover: #242424;
    --text: #e8e8e8;
    --text-muted: #888;
    --border: #2a2a2a;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 18px;
    white-space: nowrap;
}

.logo-icon { font-size: 24px; }

#nav-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    overflow: hidden;
}

#nav-breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

#nav-breadcrumb a:hover { text-decoration: underline; }
#nav-breadcrumb .sep { color: var(--border); }

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

#user-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

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

/* Buttons */
button, .btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

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

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

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

.btn-secondary:hover { background: var(--surface-hover); }

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover { background: #dc2626; }

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-google {
    background: #2a2a2a;
    color: #e8e8e8;
    border: 1px solid #3a3a3a;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    font-size: 14px;
    border-radius: var(--radius);
    text-decoration: none;
    transition: box-shadow 0.15s;
}

.btn-google:hover {
    background: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* Main content */
main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
}

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

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
}

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

/* Folder Grid */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.subfolder-grid {
    margin-bottom: 28px;
}

.folder-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.folder-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.folder-cover {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #555;
}

.folder-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.folder-info {
    padding: 12px 16px;
}

.folder-name {
    font-weight: 600;
    font-size: 16px;
}

.folder-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

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

.photo-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    background: #222;
}

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

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

.photo-thumb .photo-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
}

.photo-thumb:hover .photo-actions {
    display: flex;
    gap: 4px;
}

.photo-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}

.photo-thumb:hover .photo-overlay {
    opacity: 1;
}

.photo-overlay .heart,
.photo-overlay .photo-actions {
    pointer-events: auto;
}

.photo-overlay .photo-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

/* Heart / Favorite button */
.heart {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
    line-height: 1;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.heart svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
    display: block;
}

.heart:hover {
    transform: scale(1.15);
}

.heart:active {
    transform: scale(0.9);
}

.heart.active svg {
    fill: #ff3040;
    stroke: #ff3040;
}

.heart:not(.active) svg {
    fill: none;
    stroke: white;
    stroke-width: 2;
}

.heart:not(.active):hover svg {
    fill: rgba(255,48,64,0.3);
    stroke: white;
}

/* Pop animation on favorite */
@keyframes heart-pop {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.heart.pop {
    animation: heart-pop 0.35s ease;
}

/* Always show heart if active (even without hover) */
.photo-thumb .photo-overlay:has(.heart.active) {
    opacity: 1;
}

.lb-heart {
    position: relative;
}

.lb-heart svg {
    width: 32px;
    height: 32px;
}

/* Favorites nav button */
.btn-favorites {
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-favorites svg {
    width: 16px;
    height: 16px;
    fill: #ff3040;
    stroke: #ff3040;
    flex-shrink: 0;
}

.btn-favorites:hover {
    background: var(--surface-hover);
}

.photo-actions button {
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.photo-actions button:hover { background: rgba(0,0,0,0.8); }

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.lightbox.hidden { display: none; }

.lb-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 32px;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 8px;
}

.lb-prev, .lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    color: white;
    background: rgba(255,255,255,0.1);
    border: none;
    cursor: pointer;
    padding: 16px;
    border-radius: var(--radius);
    z-index: 1001;
}

.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,0.2); }

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

#lb-image {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    transition: transform 0.15s ease, opacity 0.15s ease;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.lb-info {
    color: white;
    font-size: 14px;
    padding: 12px;
    text-align: center;
    display: flex;
    gap: 16px;
    align-items: center;
}

.lb-info a {
    color: var(--primary);
    text-decoration: none;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden { display: none; }

.modal-content {
    background: var(--surface);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 { font-size: 18px; }

.modal-header button {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    text-align: right;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    margin: 20px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(59,130,246,0.08);
}

.drop-zone p {
    color: var(--text-muted);
    font-size: 16px;
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px;
    max-height: 200px;
    overflow-y: auto;
}

.upload-preview .thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

/* Progress */
.progress-bar {
    height: 6px;
    background: #2a2a2a;
    border-radius: 3px;
    margin: 12px 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    width: 0;
    transition: width 0.3s;
}

#progress-text {
    display: block;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    padding-bottom: 12px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
}

/* Venmo / Floating Widget */
.venmo-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 900;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    text-align: center;
    overflow: hidden;
}

.venmo-fab-title {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.venmo-fab-content {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border);
}

.venmo-fab-content img {
    width: 140px;
    height: 140px;
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.venmo-fab-content p {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.venmo-btn {
    display: inline-block;
    background: #3d95ce;
    color: white;
    padding: 8px 20px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.venmo-btn:hover { background: #2d7bb5; }

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
    header { padding: 0 12px; height: 52px; }
    main { padding: 12px; }
    .folder-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 3px; }
    .logo-icon { display: none; }
    .user-name { display: none; }
    .section-header { flex-wrap: wrap; gap: 8px; }
    .section-header h2 { font-size: 20px; }
    .admin-actions { flex-wrap: wrap; }
    .admin-actions .btn { padding: 6px 12px; font-size: 13px; }
    .lb-prev, .lb-next { padding: 10px; font-size: 22px; }
    .lb-prev { left: 4px; }
    .lb-next { right: 4px; }
    .lb-info { flex-wrap: wrap; justify-content: center; gap: 8px; font-size: 12px; }
    .modal-content { width: 95%; border-radius: 8px; }
    .drop-zone { padding: 24px; margin: 12px; }
    .heart svg { width: 24px; height: 24px; }
    .btn-favorites .fav-label { display: none; }
    .btn-favorites { padding: 6px 8px; }
    .btn-favorites svg { width: 18px; height: 18px; }

    .venmo-fab { border-radius: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.4); }
    .venmo-fab-title {
        cursor: pointer;
        transition: background 0.15s ease;
    }
    .venmo-fab-title:hover { background: var(--border); }
    .venmo-fab-content { display: none; }
    .venmo-fab.expanded { border-radius: var(--radius); }
    .venmo-fab.expanded .venmo-fab-content {
        display: block;
        animation: popup-in 0.15s ease;
    }

    @keyframes popup-in {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

@media (max-width: 480px) {
    .folder-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 2px; }
    .folder-card .folder-info { padding: 8px 10px; }
    .folder-name { font-size: 14px; }
    .folder-count { font-size: 12px; }
}
