/* ============================================================
   Fotogalerie - moderni jednoduchy design
   ============================================================ */

:root {
    --akcent: #c9a961;
    --bg: #fafafa;
    --bg-card: #ffffff;
    --text: #1a1a1a;
    --text-muted: #707070;
    --text-light: #a0a0a0;
    --border: #ececec;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.15);
    --radius: 6px;
    --radius-lg: 12px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 280ms var(--ease);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    min-height: 100dvh;
}

a { color: var(--akcent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.7; }

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

img { display: block; max-width: 100%; height: auto; }

svg { display: block; width: 100%; height: 100%; }

/* ============================================================
   Login screen
   ============================================================ */

body.is-login {
    background: linear-gradient(135deg, #f5f3f0 0%, #fafafa 50%, #f0f0f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen-login {
    width: 100%;
    max-width: 420px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.login-card {
    width: 100%;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: var(--shadow-md);
    text-align: center;
    animation: card-in 600ms var(--ease);
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    color: var(--akcent);
    background: color-mix(in srgb, var(--akcent) 12%, transparent);
    border-radius: 50%;
    padding: 14px;
}

.login-card h1 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.login-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#login-form input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: #fafafa;
    transition: all var(--transition);
    font-family: inherit;
    color: var(--text);
}

#login-form input:focus {
    outline: none;
    border-color: var(--akcent);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--akcent) 15%, transparent);
}

#login-form button {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 500;
    background: var(--text);
    color: white;
    border-radius: var(--radius);
    transition: all var(--transition);
    position: relative;
}

#login-form button:hover { background: #000; transform: translateY(-1px); }
#login-form button:active { transform: translateY(0); }
#login-form button:disabled { opacity: 0.6; cursor: wait; }

.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-error {
    color: #c53030;
    font-size: 0.85rem;
    margin-top: 4px;
    animation: shake 400ms;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.login-footer {
    color: var(--text-light);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

/* ============================================================
   Message screen (vis. windows)
   ============================================================ */

.screen-message {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.message-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: var(--shadow-md);
    text-align: center;
    max-width: 480px;
}

.message-card h1 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    font-weight: 600;
}

.message-card p { color: var(--text-muted); margin-bottom: 8px; }

/* ============================================================
   Gallery header
   ============================================================ */

.gallery-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.85);
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 22px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-title h1 {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.header-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.header-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 6px;
}

.btn-logout {
    width: 38px;
    height: 38px;
    padding: 9px;
    color: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition);
}

.btn-logout:hover {
    background: #f0f0f0;
    color: var(--text);
}

/* ============================================================
   Gallery grid
   ============================================================ */

.gallery-main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px;
    padding-bottom: 120px; /* misto pro selection bar */
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.gallery-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.gallery-item {
    position: relative;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: var(--radius);
    background: #ececec;
    cursor: pointer;
    transition: transform var(--transition);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 400ms var(--ease), transform 600ms var(--ease);
}

.gallery-item img.loaded { opacity: 1; }

.gallery-item:hover img { transform: scale(1.04); }

.gallery-item .item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.25) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.25) 100%);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

.gallery-item:hover .item-overlay { opacity: 1; }

/* Checkbox pro vyber */
.item-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
    border: 1.5px solid rgba(255,255,255,0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all var(--transition);
    opacity: 0;
    z-index: 2;
    backdrop-filter: blur(8px);
}

.gallery-item:hover .item-checkbox,
.gallery-item.selected .item-checkbox {
    opacity: 1;
}

.item-checkbox svg {
    width: 16px;
    height: 16px;
}

.gallery-item.selected .item-checkbox {
    background: var(--akcent);
    border-color: var(--akcent);
    color: white;
}

.gallery-item.selected {
    box-shadow: 0 0 0 3px var(--akcent), 0 8px 24px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.item-checkbox:hover { transform: scale(1.1); }

/* ============================================================
   Selection bar (plovouci)
   ============================================================ */

.selection-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: var(--text);
    color: white;
    border-radius: 100px;
    padding: 12px 12px 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    transition: transform 400ms var(--ease);
}

.selection-bar:not([hidden]) {
    transform: translateX(-50%) translateY(0);
}

.sel-info {
    font-size: 0.9rem;
    font-weight: 500;
}

.sel-info #sel-count {
    font-weight: 600;
    color: var(--akcent);
}

.sel-actions {
    display: flex;
    gap: 8px;
}

.btn-primary, .btn-secondary {
    padding: 10px 18px;
    border-radius: 100px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--akcent);
    color: white;
}

.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }

.btn-primary svg { width: 16px; height: 16px; }

.btn-secondary {
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover { color: white; border-color: rgba(255,255,255,0.4); }

/* ============================================================
   Lightbox
   ============================================================ */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15,15,15,0.96);
    z-index: 100;
    opacity: 0;
    transition: opacity 320ms var(--ease);
    backdrop-filter: blur(8px);
}

.lightbox.is-open { opacity: 1; }

.lb-stage {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
}

.lb-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    padding: 12px;
    color: white;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    transition: all var(--transition);
    z-index: 5;
    backdrop-filter: blur(8px);
}

.lb-close:hover {
    background: rgba(255,255,255,0.15);
    transform: rotate(90deg);
}

.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    padding: 16px;
    color: white;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    transition: all var(--transition);
    z-index: 5;
    backdrop-filter: blur(8px);
    opacity: 0.7;
}

.lb-nav:hover { background: rgba(255,255,255,0.15); opacity: 1; }
.lb-prev { left: 24px; }
.lb-next { right: 24px; }
.lb-nav:disabled { opacity: 0.2; cursor: default; }
.lb-nav:disabled:hover { background: rgba(255,255,255,0.06); }

.lb-image-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    margin: 60px 80px 100px;
}

.lb-image-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 360ms var(--ease), transform 500ms var(--ease);
}

.lb-image-wrap img.is-active {
    opacity: 1;
    transform: scale(1);
}

.lb-image-wrap img.is-leaving {
    opacity: 0;
    transform: scale(1.04);
}

.lb-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 32px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
}

.lb-counter {
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.lb-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.lb-dl {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: white;
    background: rgba(255,255,255,0.08);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.08);
}

.lb-dl:hover { background: rgba(255,255,255,0.18); }

.lb-dl svg { width: 16px; height: 16px; }

.lb-dl:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   Modal (vyber verze pro ZIP)
   ============================================================ */

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms var(--ease);
}

.modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-bg {
    position: absolute;
    inset: 0;
    background: rgba(20,20,20,0.55);
    backdrop-filter: blur(6px);
}

.modal-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 36px 32px 28px;
    max-width: 460px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    transform: scale(0.96);
    transition: transform 320ms var(--ease);
}

.modal.is-open .modal-card { transform: scale(1); }

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    padding: 10px;
    color: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition);
}

.modal-close:hover { background: #f0f0f0; color: var(--text); transform: rotate(90deg); }

.modal-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.modal-card > p { color: var(--text-muted); font-size: 0.9rem; }

.modal-sub { margin-top: 20px !important; margin-bottom: 12px !important; font-size: 0.85rem !important; }

.dl-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.dl-option {
    text-align: left;
    padding: 16px 18px;
    border-radius: var(--radius);
    background: #f7f7f7;
    border: 1.5px solid transparent;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dl-option:hover {
    background: var(--bg-card);
    border-color: var(--akcent);
    transform: translateX(2px);
}

.dl-option strong { font-weight: 600; font-size: 0.95rem; }
.dl-option small { color: var(--text-muted); font-size: 0.8rem; }

.modal-note {
    font-size: 0.8rem !important;
    color: var(--text-light) !important;
    text-align: center;
    margin-top: 8px;
}

/* ============================================================
   Footer
   ============================================================ */

.gallery-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    padding: 24px 0;
    margin-top: 60px;
}

.footer-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-author { font-weight: 500; color: var(--text); }
.footer-contact { display: flex; gap: 16px; flex-wrap: wrap; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1200px) {
    .gallery-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
    .header-inner, .gallery-main, .footer-inner { padding-left: 20px; padding-right: 20px; }
    .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .lb-image-wrap { margin: 50px 16px 90px; }
    .lb-nav { width: 44px; height: 44px; padding: 12px; }
    .lb-prev { left: 8px; }
    .lb-next { right: 8px; }
}

@media (max-width: 600px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }
    .header-title h1 { font-size: 1.15rem; }
    .header-inner { padding: 16px 16px; }
    .gallery-main { padding: 16px; padding-bottom: 120px; }
    .login-card { padding: 36px 24px; }
    .item-checkbox { opacity: 1; width: 26px; height: 26px; top: 8px; left: 8px; }
    .footer-inner { flex-direction: column; text-align: center; gap: 8px; padding: 0 16px; }
    .selection-bar { left: 12px; right: 12px; transform: translateY(120%); padding: 10px 10px 10px 18px; bottom: 12px; }
    .selection-bar:not([hidden]) { transform: translateY(0); }
    .lb-bottom { padding: 16px 16px 22px; flex-direction: column; align-items: stretch; gap: 12px; }
    .lb-counter { text-align: center; }
    .lb-actions { justify-content: center; }
    .lb-dl { padding: 8px 12px; font-size: 0.8rem; }
    .lb-dl span { display: none; }
    .lb-image-wrap { margin: 50px 8px 130px; }
    .lb-close { top: 12px; right: 12px; width: 38px; height: 38px; padding: 10px; }
}
