:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg: #F3F4F6;
    --card-bg: #FFFFFF;
    --text: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --error: #EF4444;
    --success: #10B981;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Auth */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--primary);
    cursor: pointer;
}

.card {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    max-width: 400px;
}

.tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.tab {
    flex: 1;
    background: none;
    border: none;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

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

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

input {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

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

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s, transform 0.1s;
    text-decoration: none;
    display: inline-block;
}

.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.secondary { background: var(--border); color: var(--text); }
.btn.icon { background: none; font-size: 24px; padding: 8px; }

.error { color: var(--error); font-size: 14px; text-align: center; }

.center-message {
    text-align: center;
    padding: 40px 20px;
    margin-top: 20vh;
}
.center-message h2 { margin-bottom: 16px; }
.center-message p { margin-bottom: 24px; color: var(--text-muted); }

/* Layout */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--card-bg);
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .logo { margin: 0; font-size: 20px; }
.topbar .actions { display: flex; gap: 12px; align-items: center; }

.content {
    padding: 24px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

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

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

.album-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}
.album-card:hover { transform: translateY(-2px); }
.album-card h3 { font-size: 18px; margin-bottom: 8px; }
.album-card p { font-size: 14px; color: var(--text-muted); }

/* Media Grid */
.grid-media {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.media-item {
    aspect-ratio: 1;
    background: #E5E7EB;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.media-item:hover img { transform: scale(1.05); }

.video-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 100;
    flex-direction: column;
}
.modal.open { display: flex; }

.modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: linear-gradient(rgba(0,0,0,0.5), transparent);
}
.modal-header .btn { color: white; }

.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
}
.preview-container img, .preview-container video {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.preview-info {
    padding: 16px;
    color: white;
    text-align: center;
    font-size: 14px;
}

/* Users List */
.user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* Progress */
.upload-progress {
    margin-bottom: 20px;
    background: white;
    padding: 16px;
    border-radius: 8px;
}
.progress-bar {
    height: 8px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-bar .fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
}
.progress-text { font-size: 14px; color: var(--text-muted); }

/* Share View */
.share-container {
    padding: 40px 20px;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}
.shared-media-card {
    max-width: 100%;
    margin: 0 auto;
}
.shared-media-card img, .shared-media-card video {
    max-width: 100%;
    border-radius: 8px;
}

.album-meta { margin-top: 5px; font-size: 0.9rem; color: #666; font-weight: 500; }
.album-date { font-size: 0.8rem; color: #999; margin-top: 2px; }

.uploader-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 5;
}

.selection-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--card-bg);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 20;
}
.media-item.selected {
    border: 3px solid var(--primary);
    transform: scale(0.95);
}
.media-item.selected::after {
    content: '✅';
    position: absolute;
    top: 5px; right: 5px;
    background: white;
    border-radius: 50%;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
