/* Skylight Photos — mobile-first styles */

:root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface2: #252525;
    --border: #333;
    --text: #e8e8e8;
    --text-dim: #888;
    --primary: #4a9eff;
    --primary-hover: #3a8eef;
    --danger: #e74c3c;
    --success: #27ae60;
    --radius: 10px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
}

/* Screens */
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; min-height: 100dvh; }

/* PIN Screen */
.pin-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 20px;
    text-align: center;
}

.pin-container h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.pin-container p {
    color: var(--text-dim);
    margin-bottom: 24px;
}

.pin-input-group {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 300px;
}

.pin-input-group input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 18px;
    text-align: center;
    letter-spacing: 4px;
    outline: none;
}

.pin-input-group input:focus {
    border-color: var(--primary);
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

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

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

.btn-small {
    padding: 8px 14px;
    font-size: 13px;
    background: var(--surface2);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    padding: 6px 12px;
    font-size: 12px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

header h1 { font-size: 18px; }

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content { display: none; flex: 1; padding: 16px; }
.tab-content.active { display: block; }

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

.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(74, 158, 255, 0.05);
}

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

.drop-icon {
    font-size: 48px;
    color: var(--text-dim);
    margin-bottom: 12px;
    line-height: 1;
}

.drop-zone p { color: var(--text-dim); }
.drop-hint { font-size: 13px; margin-top: 4px; }

/* Upload Queue */
.upload-queue { margin-top: 16px; }

.upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.upload-item-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--surface2);
    flex-shrink: 0;
}

.upload-item-info {
    flex: 1;
    min-width: 0;
}

.upload-item-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-item-status {
    font-size: 12px;
    color: var(--text-dim);
}

.upload-item-progress {
    width: 100%;
    height: 4px;
    background: var(--surface2);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.upload-item-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
    width: 0%;
}

.upload-item-progress-bar.done { background: var(--success); }
.upload-item-progress-bar.error { background: var(--danger); }

/* Gallery */
.gallery-stats {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--surface);
}

.gallery-item img, .gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 50%, rgba(0,0,0,0.7));
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: flex-end;
    padding: 8px;
}

.gallery-item:hover .gallery-item-overlay { opacity: 1; }

.gallery-item-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}

.gallery-item-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--danger);
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.gallery-item:hover .gallery-item-delete { display: flex; }

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-dim);
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox.hidden { display: none; }

.lightbox-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    z-index: 1001;
}

.lightbox-content {
    max-width: 95vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-content video {
    max-width: 95vw;
    max-height: 90vh;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    pointer-events: auto;
    animation: toast-in 0.3s ease;
    white-space: nowrap;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }

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

.error-msg { color: var(--danger); font-size: 14px; margin-top: 12px; }
.hidden { display: none !important; }

/* Responsive */
@media (min-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    .tab-content { padding: 24px; }
}
