/* =============================================
   JakubKrupka Gallery - Style publiczne
   Bootstrap 5.3 dark theme overrides
   ============================================= */

/* Max-width container helper */
.max-w-1200 { max-width: 1200px; }
.max-w-500 { max-width: 500px; }

/* Body fills viewport */
.public-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Main content grows */
.main-content {
    flex: 1;
}

/* Gallery card hover */
.gallery-card {
    transition: transform 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}
.gallery-card:hover {
    transform: translateY(-3px);
    border-color: var(--bs-primary) !important;
}
.gallery-card .card-img-top {
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.gallery-card:hover .card-img-top {
    transform: scale(1.05);
}
.gallery-card-placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: var(--bs-dark);
    color: var(--bs-secondary);
}

/* Photo grid items */
.photo-item {
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    background: var(--bs-dark);
}
.photo-item:hover {
    transform: translateY(-2px);
    border-color: var(--bs-primary) !important;
}
.photo-item .photo-img-wrapper {
    aspect-ratio: 1;
    overflow: hidden;
    position: relative;
    background: #111;
}
.photo-item .photo-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.photo-item:hover .photo-img-wrapper img {
    transform: scale(1.05);
}
.photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.photo-item:hover .photo-overlay {
    opacity: 1;
}
.photo-overlay i {
    font-size: 2rem;
    color: #fff;
}
.photo-item-title {
    display: block;
    padding: 6px 10px;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Gallery header */
.gallery-header h1 {
    font-size: 1.75rem;
}

/* Login box for gallery password */
.gallery-login-box {
    max-width: 420px;
    width: 100%;
}

/* Empty state */
.empty-state {
    padding: 4rem 1rem;
}
.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* =============================================
   LIGHTBOX (custom, not Bootstrap)
   ============================================= */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.lightbox.active {
    display: flex;
}
.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
    cursor: pointer;
    z-index: 0;
}
.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}
.lightbox-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 70vh;
}
.lightbox-image-container img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.6);
}
.lightbox-close {
    position: absolute;
    top: -44px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.25rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    z-index: 2;
}
.lightbox-close:hover {
    opacity: 1;
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.08);
    border: none;
    color: #fff;
    font-size: 3rem;
    width: 48px;
    height: 80px;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: opacity 0.2s, background 0.2s;
}
.lightbox-nav:hover {
    opacity: 1;
    background: rgba(255,255,255,0.18);
}
.lightbox-prev {
    left: -56px;
}
.lightbox-next {
    right: -56px;
}
.lightbox-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0 0;
    flex-wrap: wrap;
}
.lightbox-info h3 {
    font-size: 1rem;
    margin: 0;
    color: #fff;
}
.lightbox-info p {
    font-size: 0.85rem;
    color: #aaa;
    margin: 2px 0;
}
.lightbox-info .text-muted {
    font-size: 0.75rem;
}
.lightbox-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .lightbox-nav {
        width: 40px;
        font-size: 2rem;
    }
    .lightbox-prev { left: 4px; }
    .lightbox-next { right: 4px; }
    .lightbox-info {
        flex-direction: column;
        align-items: flex-start;
    }
    .gallery-card .card-img-top { height: 150px; }
}

html { scroll-behavior: smooth; }

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

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accentHover); }
img { max-width: 100%; height: auto; display: block; }

.container { max-width: var(--maxWidth); margin: 0 auto; padding: 0 16px; width: 100%; }

/* Header */
.public-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky; top: 0; z-index: 100;
}
.public-header .container {
    display: flex; align-items: center; justify-content: space-between;
}
.logo { font-size: 18px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 6px; }
.logo:hover { color: var(--accent); }

.header-actions { display: flex; gap: 8px; align-items: center; }

/* Hero */
.hero { text-align: center; padding: 60px 0 40px; }
.hero h1 { font-size: 36px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.hero p { color: var(--textDim); font-size: 18px; }

/* Gallery Grid (public listing) */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding-bottom: 60px;
}

.gallery-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform var(--transition), border-color var(--transition);
    cursor: pointer;
    display: block;
    color: inherit;
}
.gallery-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.gallery-card-image {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--surface2);
    display: flex; align-items: center; justify-content: center;
}
.gallery-card-image img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.3s ease;
}
.gallery-card:hover .gallery-card-image img { transform: scale(1.05); }

.gallery-card-placeholder {
    font-size: 48px; color: var(--textDim);
}

.gallery-card-info { padding: 16px; }
.gallery-card-info h3 { font-size: 16px; color: #fff; margin-bottom: 4px; }
.gallery-card-info p { font-size: 13px; color: var(--textDim); margin-top: 4px; }
.photo-count { font-size: 13px; color: var(--accent); }

/* Gallery View */
.gallery-view { padding: 30px 0 60px; }

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}
.gallery-header h1 { font-size: 28px; color: #fff; margin: 8px 0; }
.gallery-desc { color: var(--textDim); font-size: 15px; margin-bottom: 8px; max-width: 600px; }
.gallery-meta { display: flex; gap: 12px; align-items: center; font-size: 14px; color: var(--textDim); }
.gallery-actions-top { display: flex; gap: 8px; flex-shrink: 0; }

.back-link { font-size: 14px; color: var(--textDim); }
.back-link:hover { color: #fff; }

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

.photo-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radiusSm);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition);
}
.photo-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.photo-img-wrapper {
    aspect-ratio: 1;
    overflow: hidden;
    position: relative;
    background: var(--surface2);
}
.photo-img-wrapper img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.3s ease;
}
.photo-item:hover .photo-img-wrapper img { transform: scale(1.05); }

.photo-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity var(--transition);
}
.photo-item:hover .photo-overlay { opacity: 1; }
.photo-zoom-icon { font-size: 32px; }

.photo-item-title {
    display: block;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--textDim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Login (gallery password) */
.gallery-login-container {
    display: flex; align-items: center; justify-content: center;
    min-height: 60vh; padding: 40px 0;
}
.gallery-login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 420px; width: 100%;
    text-align: center;
}
.gallery-login-icon { font-size: 48px; margin-bottom: 12px; }
.gallery-login-box h1 { font-size: 22px; color: #fff; margin-bottom: 8px; }
.gallery-login-desc { color: var(--textDim); font-size: 14px; margin-bottom: 24px; }
.gallery-login-form { text-align: left; }
.gallery-login-footer { margin-top: 20px; font-size: 14px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 18px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radiusSm);
    color: var(--text);
    font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: var(--border); color: #fff; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accentHover); border-color: var(--accentHover); }

.btn-secondary { background: var(--surface2); border-color: var(--border); }
.btn-secondary:hover { background: #333; }

.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn-link { background: none; border: none; padding: 0; color: var(--accent); font-size: 14px; }
.btn-link:hover { color: var(--accentHover); background: none; }

.btn-admin-link { color: var(--warning); border-color: var(--warning); }
.btn-admin-link:hover { background: var(--warning); color: #000; }

/* Forms */
.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; color: var(--textDim); font-size: 13px; font-weight: 500; }
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%; padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radiusSm);
    color: #fff; font-size: 14px;
    transition: border-color var(--transition);
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; font-family: inherit; }
small { display: block; margin-top: 4px; color: var(--textDim); font-size: 12px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radiusSm); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }

/* Badges */
.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--accent); }
.badge-default { background: var(--surface2); color: var(--textDim); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h2 { font-size: 22px; color: #fff; margin-bottom: 8px; }
.empty-state p { color: var(--textDim); margin-bottom: 20px; font-size: 15px; }

/* Footer */
.site-footer {
    margin-top: auto; text-align: center; padding: 24px;
    color: var(--textDim); font-size: 13px;
    border-top: 1px solid var(--border);
}

/* =============================================
   LIGHTBOX
   ============================================= */
.lightbox {
    position: fixed; inset: 0; z-index: 9999;
    display: none; align-items: center; justify-content: center;
}
.lightbox.active { display: flex; }

.lightbox-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.92);
    cursor: pointer;
}

.lightbox-content {
    position: relative; z-index: 1;
    max-width: 95vw; max-height: 95vh;
    display: flex; flex-direction: column;
}

.lightbox-image-container {
    display: flex; align-items: center; justify-content: center;
    max-height: 70vh;
}
.lightbox-image-container img {
    max-width: 100%; max-height: 70vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 40px rgba(0,0,0,0.5);
}

.lightbox-info {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 16px 0;
    flex-wrap: wrap;
}
.lightbox-text h3 { color: #fff; font-size: 16px; margin-bottom: 2px; }
.lightbox-text p { color: #aaa; font-size: 13px; margin-bottom: 2px; }
.lightbox-text span { color: #666; font-size: 12px; }
.lightbox-actions { display: flex; gap: 8px; flex-shrink: 0; }

.lightbox-close {
    position: absolute; top: -40px; right: 0;
    background: none; border: none; color: #fff;
    font-size: 36px; cursor: pointer; line-height: 1;
    opacity: 0.7; transition: opacity var(--transition);
}
.lightbox-close:hover { opacity: 1; }

.lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.08); border: none; color: #fff;
    font-size: 48px; width: 50px; height: 80px;
    cursor: pointer; border-radius: 4px;
    opacity: 0.6; transition: opacity var(--transition), background var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.lightbox-nav:hover { opacity: 1; background: rgba(255,255,255,0.15); }
.lightbox-prev { left: -60px; }
.lightbox-next { right: -60px; }

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 26px; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .photos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
    .gallery-header { flex-direction: column; }
    .lightbox-nav { width: 40px; font-size: 36px; }
    .lightbox-prev { left: 0; }
    .lightbox-next { right: 0; }
    .lightbox-info { flex-direction: column; align-items: flex-start; }
    .gallery-login-box { padding: 24px; }
}
