/**
 * Fotobox Frontend Styles
 */

/* Gallery Container */
.fotobox-gallery {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Gallery Header */
.fotobox-header {
    text-align: center;
    margin-bottom: 30px;
}

.fotobox-title {
    font-size: 2em;
    margin-bottom: 10px;
    color: #333;
}

.fotobox-description {
    font-size: 1.1em;
    color: #666;
}

/* Tabs Row: tabs left/center, download-all right */
/* Subcategories left, Download button right */
.fotobox-tabs-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.fotobox-tabs-download {
    margin-left: auto;
    flex-shrink: 0;
}

.fotobox-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
    justify-content: center;
}

/* Unified button style (Elementor-like) */
.fotobox-tab,
.fotobox-download-all,
.fotobox-download,
.fotobox-download-audio,
.fotobox-download-video,
.fotobox-lightbox-download,
.fotobox-lightbox-fullscreen,
.fotobox-lightbox-like,
.fotobox-dl-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    background-color: var(--e-global-color-primary, #CCAD60);
    font-family: "Lato", Sans-serif;
    font-size: 15px;
    font-weight: 800;

    color: #412F03;
    fill: #412F03;

    box-shadow: 0px 0px 5px 2px #CCAD60 inset;
    border: none;
    border-radius: 36px;
    padding: 18px 35px;
    text-decoration: none;
    cursor: pointer;
    text-transform: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.fotobox-tab:hover,
.fotobox-download-all:hover,
.fotobox-download:hover,
.fotobox-download-audio:hover,
.fotobox-download-video:hover,
.fotobox-lightbox-download:hover,
.fotobox-lightbox-fullscreen:hover,
.fotobox-lightbox-like:hover,
.fotobox-dl-btn-primary:hover:not(:disabled) {
    background-color: #e3c878;
    box-shadow: 0px 0px 6px 3px #d8ba66 inset;
}

.fotobox-tab.active {
    background-color: #412F03;
    color: #FDF6E3;
    box-shadow: 0px 0px 5px 2px #2d2003 inset;
}

.fotobox-download-all:disabled,
.fotobox-dl-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fotobox-download-all .dashicons,
.fotobox-download .dashicons,
.fotobox-download-audio .dashicons,
.fotobox-download-video .dashicons,
.fotobox-lightbox-download .dashicons,
.fotobox-lightbox-fullscreen .dashicons,
.fotobox-lightbox-like .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
}

/* Photo Grid */
.fotobox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.fotobox-item {
    aspect-ratio: 1;
    overflow: hidden;
    background: #f0f0f0;
    border-radius: 0;
    position: relative;
}

.fotobox-item.hidden {
    display: none;
}

/* Image Tile */
.fotobox-image {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
}

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

.fotobox-image:hover img {
    transform: scale(1.05);
}

.fotobox-overlay {
    position: absolute;
    top: 0;
    right: 0;
    padding: 10px;
    display: flex;
    gap: 5px;
}

.fotobox-star,
.fotobox-download {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.fotobox-star:hover,
.fotobox-download:hover {
    background: rgba(0, 0, 0, 0.7);
}

.fotobox-star[data-starred="true"] .dashicons-star-empty::before {
    content: "\f155";
    color: #f39c12;
}

/* Audio Tile - matches Next.js gallery style */
.fotobox-audio {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-radius: 0.75rem;
    background: linear-gradient(to bottom, #2a1a1f, #1a0f14);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 0, 0, 0.5);
}

.fotobox-audio-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/audio-bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.fotobox-audio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.fotobox-audio-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 1rem;
}

.fotobox-audio-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
    margin: 0;
    padding: 0.5rem 0.5rem 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fotobox-audio-player-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 0;
}

.fotobox-audio-player-box {
    width: 100%;
    max-width: 200px;
    padding: 1rem;
    border-radius: 1rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

.fotobox-audio-player-box .fotobox-audio-player {
    width: 100%;
    height: 40px;
    display: block;
}

.fotobox-download-audio {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    text-decoration: none;
}
.fotobox-download-audio:hover {
    background: rgba(255, 255, 255, 0.35);
    color: #fff;
}

/* Style native audio controls: white time text, accent color for progress */
.fotobox-audio audio::-webkit-media-controls-panel {
    background: transparent;
}

.fotobox-audio audio::-webkit-media-controls-enclosure {
    background: transparent;
}

.fotobox-audio audio::-webkit-media-controls-current-time-display,
.fotobox-audio audio::-webkit-media-controls-time-remaining-display {
    color: #fff;
}

.fotobox-audio audio::-webkit-media-controls-timeline {
    border-radius: 9999px;
}

.fotobox-audio audio::-webkit-media-controls-play-button {
    opacity: 0.9;
}

/* Accent color for progress (Next.js uses #f43f5e) */
.fotobox-audio audio {
    accent-color: #f43f5e;
}

/* Video Tile - matches Next.js gallery style */
.fotobox-video {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #111827;
}

.fotobox-video .fotobox-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Top bar: download top-left, title center; bar captures clicks so download link works */
.fotobox-video-bar-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem 2rem;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
    pointer-events: auto;
}

.fotobox-video-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.fotobox-download-video {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.875rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0.375rem;
    text-decoration: none;
    position: relative;
    z-index: 2;
}
.fotobox-download-video:hover {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}

.fotobox-open-lightbox-video {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.875rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
}
.fotobox-open-lightbox-video:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* No bottom bar overlay - native video controls stay visible and clickable */

/* Video controls: transparent panel, white time, accent progress */
.fotobox-video video::-webkit-media-controls-panel {
    background: transparent;
}

.fotobox-video video::-webkit-media-controls-enclosure {
    background: transparent;
}

.fotobox-video video::-webkit-media-controls-current-time-display,
.fotobox-video video::-webkit-media-controls-time-remaining-display {
    color: #fff;
}

.fotobox-video video::-webkit-media-controls-timeline {
    border-radius: 9999px;
}

.fotobox-video video::-webkit-media-controls-play-button {
    opacity: 0.9;
}

.fotobox-video video {
    accent-color: #f43f5e;
}

/* Lightbox */
.fotobox-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fotobox-lightbox-content {
    max-width: 90%;
    max-height: 90%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fotobox-lightbox-media {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fotobox-lightbox-content img,
.fotobox-lightbox-content video {
    max-width: 100%;
    max-height: 84vh;
    object-fit: contain;
}

.fotobox-lightbox-actions {
    position: absolute;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 10010;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fotobox-lightbox-like,
.fotobox-lightbox-download,
.fotobox-lightbox-fullscreen {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 10px 14px;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.fotobox-lightbox-like:hover,
.fotobox-lightbox-download:hover,
.fotobox-lightbox-fullscreen:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.fotobox-close,
.fotobox-prev,
.fotobox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 2em;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.fotobox-close {
    top: 20px;
    right: 20px;
}

.fotobox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.fotobox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.fotobox-close:hover,
.fotobox-prev:hover,
.fotobox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========== Download Popup (full-screen, 5 steps) ========== */
.fotobox-dl-popup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: #fff;
}

.fotobox-dl-popup-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.fotobox-dl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.fotobox-dl-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.fotobox-dl-close {
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
    line-height: 1;
}

.fotobox-dl-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.fotobox-dl-body {
    flex: 1;
    overflow-y: auto;
}

.fotobox-dl-content {
    max-width: 42rem;
    margin: 0 auto;
    padding: 2rem;
}

.fotobox-dl-step-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.5rem;
}

.fotobox-dl-step-desc {
    color: #6b7280;
    margin: 0 0 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
}

.fotobox-dl-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.fotobox-dl-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.fotobox-dl-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

.fotobox-dl-categories {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.fotobox-dl-cat-label {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.fotobox-dl-cat-label:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.fotobox-dl-cat-label input {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0 1rem 0 0;
    accent-color: #2271b1;
    flex-shrink: 0;
}

.fotobox-dl-cat-label.checked {
    border-color: #2271b1;
    background: #f0f6fc;
}

.fotobox-dl-destinations {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.fotobox-dl-dest {
    display: block;
    width: 100%;
    padding: 1.25rem 1.5rem;
    text-align: left;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.fotobox-dl-dest:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.fotobox-dl-dest.selected {
    border-color: #2271b1;
    background: #f0f6fc;
}

.fotobox-dl-dest strong {
    display: block;
    font-size: 1.125rem;
    color: #111827;
    margin-bottom: 0.25rem;
}

.fotobox-dl-dest span {
    font-size: 0.875rem;
    color: #6b7280;
}

.fotobox-dl-dest.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fotobox-dl-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.fotobox-dl-btn-primary {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: #2271b1;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.fotobox-dl-btn-primary:hover:not(:disabled) {
    background: #135e96;
}

.fotobox-dl-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fotobox-dl-btn-ghost {
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #374151;
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.fotobox-dl-btn-ghost:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.fotobox-dl-processing {
    text-align: center;
    padding: 3rem 0;
}

.fotobox-dl-spinner {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.5rem;
    border: 4px solid #e5e7eb;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: fotobox-dl-spin 0.7s linear infinite;
}

@keyframes fotobox-dl-spin {
    to { transform: rotate(360deg); }
}

.fotobox-dl-progress-wrap {
    max-width: 20rem;
    height: 8px;
    background: #e5e7eb;
    border-radius: 9999px;
    margin: 1rem auto 0;
    overflow: hidden;
}

.fotobox-dl-progress-bar {
    height: 100%;
    background: #2271b1;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.fotobox-dl-complete {
    text-align: center;
    padding: 3rem 0;
}

.fotobox-dl-check {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #16a34a;
    background: #dcfce7;
    border-radius: 50%;
}

.fotobox-dl-download-now {
    display: inline-block;
    margin-bottom: 1rem;
    text-decoration: none;
}

.fotobox-dl-email-sent {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 1.5rem;
}

.fotobox-dl-again {
    margin-top: 0.5rem;
}

/* Password Form */
.fotobox-password-form {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    text-align: center;
}

.fotobox-password-form input {
    width: 100%;
    padding: 10px;
    margin: 15px 0;
    border: 1px solid #ddd;
    font-size: 1em;
}

.fotobox-password-form button {
    padding: 10px 30px;
    background: #333;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1em;
}

.fotobox-password-form button:hover {
    background: #555;
}

/* Galleries List */
.fotobox-galleries-grid {
    display: grid;
    gap: 30px;
    margin: 30px 0;
}

.fotobox-galleries-grid.columns-2 {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
}

.fotobox-galleries-grid.columns-3 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.fotobox-galleries-grid.columns-4 {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.fotobox-gallery-card {
    background: #fff;
    border: 1px solid #ddd;
    overflow: hidden;
    transition: all 0.3s;
}

.fotobox-gallery-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.fotobox-gallery-cover {
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
}

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

.fotobox-gallery-card:hover .fotobox-gallery-cover img {
    transform: scale(1.05);
}

.fotobox-gallery-info {
    padding: 20px;
}

.fotobox-gallery-info h3 {
    margin: 0 0 10px 0;
    font-size: 1.3em;
}

.fotobox-gallery-meta {
    color: #666;
    font-size: 0.9em;
    margin: 10px 0;
}

.fotobox-view-gallery {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 20px;
    background: #333;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s;
}

.fotobox-view-gallery:hover {
    background: #555;
}

/* Gallery reference search block (shortcode [fotobox_gallery_search]) */
.fotobox-gallery-search {
    max-width: 42rem;
    margin: 2rem auto 2rem;
    padding: 0 1rem;
}

.fotobox-gallery-search-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.fotobox-gallery-search-title {
    font-size: 1.5rem;
    margin: 0 0 0.5rem;
    font-weight: 700;
}

.fotobox-gallery-search-desc {
    color: #666;
    margin: 0 0 1rem;
}

.fotobox-gallery-search-form {
    margin: 0;
}

.fotobox-gallery-search-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fotobox-gallery-search-input {
    flex: 1;
    min-width: 12rem;
    padding: 0.75rem 1rem;
    font-size: 1.125rem;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.fotobox-gallery-search-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

.fotobox-gallery-search-submit {
    padding: 0.75rem 1.5rem;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #1a1a1a;
    border-radius: 2px;
    cursor: pointer;
    white-space: nowrap;
}

.fotobox-gallery-search-submit:hover:not(:disabled) {
    background: #2a2a2a;
}

.fotobox-gallery-search-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.fotobox-gallery-search-error {
    margin: 0.5rem 0 0;
    color: #b32d2e;
    font-size: 0.875rem;
}

.fotobox-gallery-search-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: fotobox-spin 0.6s linear infinite;
}

@keyframes fotobox-spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .fotobox-tabs-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .fotobox-tabs-download {
        margin-left: 0;
        align-self: center;
    }

    .fotobox-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 10px;
    }
    
    .fotobox-galleries-grid {
        grid-template-columns: 1fr !important;
    }

    .fotobox-lightbox-actions {
        bottom: 16px;
        gap: 8px;
    }

    .fotobox-lightbox-like,
    .fotobox-lightbox-download,
    .fotobox-lightbox-fullscreen {
        padding: 8px 10px;
        font-size: 12px;
    }
}
