@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f5f6fb;
    --surface: #ffffff;
    --surface-alt: #f4f5fa;
    --border: #e3e5ef;
    --primary: #3b5fe3;
    --primary-dark: #2c48ba;
    --primary-tint: #eef1ff;
    --navy: #10162b;
    --navy-alt: #161f45;
    --text: #14162b;
    --text-muted: #6b7280;
    --danger: #e5484d;
    --danger-dark: #c93a3f;
    --success-bg: #e6f6ec;
    --success-text: #1c7a3f;
    --error-bg: #fde8e8;
    --error-text: #a3251d;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}
header.topbar {
    background: var(--navy);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
header.topbar a { color: #fff; text-decoration: none; }
header.topbar .brand { font-weight: 800; font-size: 1.15rem; letter-spacing: .2px; display: inline-flex; align-items: center; }
header.topbar .brand-mark {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-block;
    margin-right: 8px;
}
header.topbar nav a { margin-left: 16px; opacity: .85; }
header.topbar nav a:hover { opacity: 1; text-decoration: underline; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(16,22,43,.05);
    margin-bottom: 20px;
}

h1 { font-size: 1.4rem; margin: 0 0 16px; font-weight: 800; color: var(--text); }
h2 { font-size: 1.15rem; margin: 0 0 12px; font-weight: 700; color: var(--text); }

.btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 9px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: .92rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn:not(.secondary):not(.danger) { box-shadow: 0 6px 16px rgba(59,95,227,.28); }
.btn:not(.secondary):not(.danger):hover { box-shadow: 0 8px 20px rgba(59,95,227,.36); }
.btn.secondary { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: #e9ebf3; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: var(--danger-dark); }
.btn.small { padding: 5px 10px; font-size: .8rem; }

input[type=text], input[type=password], input[type=file] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    margin-bottom: 12px;
    background: var(--surface);
    color: var(--text);
}
input[type=text]:focus, input[type=password]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

.error { background: var(--error-bg); color: var(--error-text); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.success { background: var(--success-bg); color: var(--success-text); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }

.login-box { max-width: 360px; margin: 10vh auto 0; }

.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.album-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16,22,43,.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .15s, box-shadow .15s;
}
.album-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(16,22,43,.1); }
.album-card .thumb {
    aspect-ratio: 4/3;
    background: var(--surface-alt) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='40' height='40'%3E%3Cpath fill='%23c2c9e6' d='M21 19V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") no-repeat center;
    background-size: cover;
}
.album-card .info { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.album-card .name { font-weight: 700; }
.album-card .meta { font-size: .82rem; color: var(--text-muted); }
.album-card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }

.albums-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.albums-search {
    flex: 1 1 220px;
    min-width: 160px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .9rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
.albums-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
}
.albums-sort {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .88rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    flex: 0 0 auto;
}
.view-btn {
    border: none;
    background: var(--surface);
    color: var(--text-muted);
    padding: 8px 12px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}
.view-btn + .view-btn { border-left: 1px solid var(--border); }
.view-btn.active { background: var(--primary-tint); color: var(--primary); }
.view-btn:hover { background: var(--surface-alt); }

.albums-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.albums-grid.list-view .album-card {
    flex-direction: row;
    align-items: stretch;
}
.albums-grid.list-view .album-card .thumb {
    width: 96px;
    aspect-ratio: auto;
    flex: 0 0 96px;
}
.albums-grid.list-view .album-card .info {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    flex-wrap: wrap;
}
.albums-grid.list-view .album-card .name { flex: 0 0 auto; min-width: 140px; }
.albums-grid.list-view .album-card .meta { flex: 0 0 auto; }
.albums-grid.list-view .album-card .actions { margin-top: 0; margin-left: auto; }

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.photo-grid figure { margin: 0; position: relative; }
.photo-grid img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}
.photo-grid figcaption {
    position: absolute;
    bottom: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
}

.share-link-box {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    padding: 8px 10px;
    border-radius: 9px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.share-link-box input {
    flex: 1;
    min-width: 200px;
    margin: 0;
    border: none;
    background: transparent;
    font-size: .85rem;
}

.public-header { text-align: center; padding: 30px 16px 10px; }
.public-header h1 { font-size: 1.6rem; }

.empty { color: var(--text-muted); font-style: italic; padding: 20px 0; }

footer.foot { text-align: center; color: #9aa0ab; font-size: .8rem; padding: 30px 0 10px; }

/* ---- Zona de arrastrar y soltar ---- */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 26px 16px;
    text-align: center;
    color: var(--text-muted);
    transition: background .15s, border-color .15s;
}
.dropzone p { margin: 0 0 10px; }
.dropzone.dragover { background: var(--primary-tint); border-color: var(--primary); }

/* ---- Selección múltiple ---- */
.select-box {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    margin: 0;
    z-index: 3;
    cursor: pointer;
    accent-color: var(--primary);
}
.cover-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(16,22,43,.82);
    color: #fff;
    font-size: .7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
}

/* ---- Lightbox ---- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10,11,20,.94);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 6px;
}
.lightbox-close, .lightbox-nav {
    position: absolute;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-close:hover, .lightbox-nav:hover { background: var(--primary); }
.lightbox-close { top: 16px; right: 16px; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* ---- Login / pantalla de autenticación ---- */
.auth-body { margin: 0; min-height: 100vh; background: var(--navy); }
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}
.auth-side {
    background:
        radial-gradient(circle at 15% 20%, rgba(59,95,227,.35), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(59,95,227,.25), transparent 40%),
        var(--navy);
    color: #fff;
    padding: 60px 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-side-brand { font-size: 1.9rem; font-weight: 800; margin-bottom: 16px; }
.auth-side-tagline { color: rgba(255,255,255,.78); font-size: 1.02rem; line-height: 1.5; max-width: 380px; margin: 0 0 26px; }
.auth-side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
.auth-side-list li {
    color: rgba(255,255,255,.85);
    font-size: .92rem;
    padding-left: 26px;
    position: relative;
}
.auth-side-list li::before {
    content: "";
    position: absolute;
    left: 0; top: 5px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: rgba(59,95,227,.35);
    border: 1.5px solid var(--primary);
}
.auth-form-side {
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}
.auth-form-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(16,22,43,.12);
    padding: 36px 34px;
    max-width: 380px;
    width: 100%;
}
.auth-title { margin: 0 0 6px; font-size: 1.5rem; }
.auth-subtitle { color: var(--text-muted); margin: 0 0 20px; font-size: .92rem; }
.field-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }

@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-side { padding: 40px 28px; }
    .auth-side-tagline, .auth-side-list { display: none; }
}

/* ---- Responsividad ---- */
@media (max-width: 640px) {
    .wrap { padding: 16px 12px 50px; }
    .card { padding: 16px; }
    h1 { font-size: 1.2rem; }
    header.topbar { padding: 12px 14px; }
    header.topbar nav a { margin-left: 12px; font-size: .9rem; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 8px; }
    .albums-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .lightbox-nav { width: 38px; height: 38px; font-size: 1.1rem; }
    .lightbox-close { width: 38px; height: 38px; top: 10px; right: 10px; }
}
