/* ========================================
   Panel Klienta — Galeria zdjęć
   ======================================== */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #234F60 0%, #121111 100%);
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
}

.login-box .logo-text {
    color: #C9A227;
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.login-box .login-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.9rem; }
.form-group input {
    width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px;
    font-size: 1rem; transition: border-color 0.3s;
}
.form-group input:focus { outline: none; border-color: #234F60; box-shadow: 0 0 0 3px rgba(35,79,96,0.1); }

.btn {
    padding: 12px 24px; border: none; border-radius: 6px; font-size: 1rem;
    font-weight: 500; cursor: pointer; transition: all 0.3s; display: inline-flex;
    align-items: center; gap: 8px;
}
.btn-primary { background: #234F60; color: white; }
.btn-primary:hover { background: #1a3d4d; }
.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #5a6268; }
.btn-gold { background: #C9A227; color: white; }
.btn-gold:hover { background: #b08d1f; }
.btn-small { padding: 8px 16px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.error-msg { background: #fee; color: #c33; padding: 12px; border-radius: 6px; margin-bottom: 15px; font-size: 0.9rem; display: none; }
.success-msg { background: #e8f5e9; color: #2e7d32; padding: 12px; border-radius: 6px; margin-bottom: 15px; display: none; }

/* Layout */
.panel-container { max-width: 1200px; margin: 0 auto; padding: 20px; }

.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    background: white; padding: 15px 25px; border-radius: 12px;
    margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.panel-header .brand {
    color: #C9A227; font-size: 1.1rem; font-weight: 300; letter-spacing: 2px;
}

.panel-header .user-info {
    display: flex; align-items: center; gap: 15px; font-size: 0.9rem; color: #666;
}

.panel-main {
    background: white; border-radius: 12px; padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); min-height: 60vh;
}

.breadcrumb {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 20px; font-size: 0.95rem; color: #666; flex-wrap: wrap;
}
.breadcrumb a { color: #234F60; text-decoration: none; cursor: pointer; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #ccc; }

/* Selection counter */
.selection-counter {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; background: #f8f9fa; border-radius: 20px;
    font-weight: 500; font-size: 0.9rem; margin-bottom: 20px;
}
.selection-counter .count { color: #C9A227; font-weight: 700; }
.selection-counter.limit-reached { background: #fff3cd; color: #856404; }

/* Folders */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.folder-card {
    background: #f8f9fa; border: 2px solid #e8e8e8; border-radius: 12px;
    padding: 25px; cursor: pointer; transition: all 0.3s; text-align: center;
}
.folder-card:hover { border-color: #C9A227; box-shadow: 0 4px 15px rgba(201,162,39,0.2); transform: translateY(-3px); }
.folder-card .folder-icon { font-size: 3rem; color: #C9A227; margin-bottom: 12px; }
.folder-card .folder-name { font-weight: 600; color: #234F60; font-size: 1.05rem; margin-bottom: 6px; }
.folder-card .folder-count { font-size: 0.85rem; color: #999; }

/* Photo grid */
.photos-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.photo-card {
    position: relative; border-radius: 8px; overflow: hidden;
    border: 3px solid transparent; transition: all 0.2s;
    background: #eee; cursor: pointer; aspect-ratio: 1;
}
.photo-card:hover { border-color: #234F60; }
.photo-card.selected { border-color: #C9A227; box-shadow: 0 0 0 3px rgba(201,162,39,0.3); }
.photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }

.photo-card .select-badge {
    position: absolute; top: 8px; right: 8px;
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,0.9); display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; color: #ccc; transition: all 0.2s;
}
.photo-card.selected .select-badge { background: #C9A227; color: white; }
.photo-card .comment-badge {
    position: absolute; top: 8px; left: 8px;
    width: 24px; height: 24px; border-radius: 50%;
    background: #1976d2; color: white; display: flex; align-items: center; justify-content: center;
    font-size: 0.65rem;
}
.photo-card .download-badge {
    position: absolute; bottom: 8px; right: 8px;
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(46,125,50,0.9); color: white; display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; cursor: pointer;
}
.photo-card .download-badge:hover { background: #2e7d32; transform: scale(1.1); }

.photo-card .video-badge {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 2.5rem; color: rgba(255,255,255,0.85);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.92); z-index: 9999;
    display: flex; flex-direction: column;
}

.lightbox-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 20px; color: white; flex-shrink: 0;
}
.lightbox-header .filename { font-size: 0.9rem; opacity: 0.8; }
.lightbox-close {
    background: none; border: none; color: white; font-size: 1.5rem;
    cursor: pointer; padding: 8px; border-radius: 50%; transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.1); }

.lightbox-body {
    flex: 1; display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.lightbox-body img {
    max-width: 90%; max-height: 80vh; object-fit: contain;
    user-select: none; -webkit-user-drag: none;
}

.lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.15); border: none; color: white;
    font-size: 1.5rem; padding: 15px; cursor: pointer; border-radius: 50%;
    transition: background 0.2s;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-nav.prev { left: 15px; }
.lightbox-nav.next { right: 15px; }

.lightbox-footer {
    padding: 15px 20px; color: white; flex-shrink: 0;
}

.lightbox-actions {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin-bottom: 10px;
}

.lightbox-select-btn {
    padding: 8px 20px; border: 2px solid #C9A227; border-radius: 20px;
    background: transparent; color: #C9A227; font-size: 0.9rem;
    cursor: pointer; transition: all 0.2s; font-weight: 500;
}
.lightbox-select-btn.selected { background: #C9A227; color: white; }
.lightbox-select-btn:hover { background: #C9A227; color: white; }

.lightbox-download-btn {
    padding: 8px 20px; border: 2px solid #2e7d32; border-radius: 20px;
    background: transparent; color: #2e7d32; font-size: 0.9rem;
    cursor: pointer; transition: all 0.2s;
}
.lightbox-download-btn:hover { background: #2e7d32; color: white; }

.lightbox-comment {
    display: flex; gap: 8px; align-items: flex-start;
}
.lightbox-comment textarea {
    flex: 1; padding: 10px; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px; background: rgba(255,255,255,0.1); color: white;
    font-size: 0.9rem; resize: none; min-height: 45px; font-family: inherit;
}
.lightbox-comment textarea::placeholder { color: rgba(255,255,255,0.4); }
.lightbox-comment textarea:focus { outline: none; border-color: #C9A227; }
.lightbox-comment button {
    padding: 10px 16px; background: #234F60; color: white;
    border: none; border-radius: 8px; cursor: pointer; font-size: 0.85rem;
    transition: background 0.2s; white-space: nowrap;
}
.lightbox-comment button:hover { background: #1a3d4d; }

/* Selections page */
.selections-summary {
    display: flex; gap: 20px; margin-bottom: 25px; flex-wrap: wrap;
}
.summary-card {
    flex: 1; min-width: 150px; padding: 20px; background: #f8f9fa;
    border-radius: 10px; text-align: center;
}
.summary-card .num { font-size: 2rem; font-weight: 700; color: #234F60; }
.summary-card .label { font-size: 0.85rem; color: #666; }

.selections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.sel-photo-card {
    border-radius: 8px; overflow: hidden; border: 2px solid #C9A227;
    background: #eee; position: relative;
}
.sel-photo-card img {
    width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
    user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.sel-photo-card .sel-photo-info {
    padding: 8px; background: white; font-size: 0.8rem;
}
.sel-photo-card .sel-photo-name {
    font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sel-photo-card .sel-photo-comment {
    color: #666; font-style: italic; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Responsive */
@media (max-width: 768px) {
    .panel-container { padding: 10px; }
    .panel-header { flex-direction: column; gap: 10px; text-align: center; }
    .photos-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .folders-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .lightbox-body img { max-width: 95%; max-height: 70vh; }
    .lightbox-nav { padding: 10px; font-size: 1.2rem; }
    .lightbox-nav.prev { left: 5px; }
    .lightbox-nav.next { right: 5px; }
}

@media (max-width: 480px) {
    .photos-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .selections-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Prevent right-click on images */
.photo-card img, .lightbox-body img, .sel-photo-card img {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: none;
}

/* ===== Okno zgód (RODO / regulamin) ===== */
.cp-consent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 35, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    backdrop-filter: blur(2px);
}
.cp-consent-box {
    background: #fff;
    border-radius: 14px;
    max-width: 540px;
    width: 100%;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    animation: cpConsentIn 0.18s ease-out;
}
@keyframes cpConsentIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.cp-consent-title {
    color: #234F60;
    font-size: 1.4rem;
    margin: 0 0 12px;
}
.cp-consent-intro {
    color: #4a5a62;
    line-height: 1.55;
    margin: 0 0 14px;
}
.cp-consent-terms {
    margin: 0 0 16px;
}
.cp-consent-terms a {
    color: #C9A227;
    font-weight: 600;
    text-decoration: none;
}
.cp-consent-terms a:hover { text-decoration: underline; }
.cp-consent-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #f5f7f8;
    border: 1px solid #e0e6e9;
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    color: #2b3a42;
    line-height: 1.4;
}
.cp-consent-check input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; cursor: pointer; }
.cp-consent-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 22px;
    flex-wrap: wrap;
}
.cp-consent-actions .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 480px) {
    .cp-consent-box { padding: 22px 18px; }
    .cp-consent-actions { justify-content: stretch; }
    .cp-consent-actions .btn { flex: 1; }
}
