/* lightbox.css - Reusable premium photo viewer styles */

#lightbox {
    display: none;
    position: fixed;
    z-index: 30000;
    /* Extremely high to cover everything (modals go up to 12000) */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

#imgGrande {
    width: 95vw;
    height: 82vh;
    object-fit: contain;
    user-select: none;
    z-index: 30005;
    transform-origin: center center;
    will-change: transform;
    cursor: grab;
}

.lb-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    z-index: 30100;
}

.lb-header-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lb-btn,
.lb-close,
.lb-trash,
.lb-ptd,
.lb-download-single,
.lb-draw-btn,
.lb-info-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    font-size: 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-decoration: none;
}

.lb-btn:hover,
.lb-close:hover,
.lb-trash:hover,
.lb-ptd:hover,
.lb-download-single:hover,
.lb-draw-btn:hover,
.lb-info-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.lb-close {
    font-size: 26px;
}

/* Modal / Drawer de Información Completa */
.lb-info-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92%;
    max-width: 560px;
    max-height: 86vh;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    padding: 20px;
    box-sizing: border-box;
    z-index: 30200;
    color: #f8fafc;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(16px);
    overflow-y: auto;
    text-align: left;
}

.lb-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.lb-info-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #38bdf8;
}

.lb-info-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.lb-info-close:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.lb-info-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.lb-info-section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 8px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lb-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 12px;
    font-size: 0.85rem;
}

.lb-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lb-info-label {
    color: #94a3b8;
    font-size: 0.73rem;
}

.lb-info-val {
    color: #f1f5f9;
    font-weight: 600;
    word-break: break-all;
}

.lb-metadata {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    text-align: center;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 40px 20px 80px 20px;
    /* Leave space for browser bars on mobile */
    box-sizing: border-box;
    pointer-events: auto;
    z-index: 30100;
}

.lb-meta-line {
    margin-bottom: 5px;
}

.lb-location-btn {
    display: inline-block;
    margin-top: 8px;
    color: #4285f4;
    text-decoration: none;
    background: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.75rem;
    transition: 0.2s;
}

.lb-location-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

@media (max-width: 600px) {
    .lb-top-bar {
        padding: 10px;
    }

    .lb-btn,
    .lb-close,
    .lb-trash,
    .lb-ptd,
    .lb-download-single {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .lb-metadata {
        font-size: 0.8rem;
        padding-bottom: 60px;
    }
}

/* Drawing Mode Styles */
#lbCanvas {
    position: absolute;
    z-index: 30010;
    pointer-events: none; /* Controlled by JS based on active tool */
    touch-action: none;
    transform-origin: center center;
    will-change: transform;
}

#lbDrawToolbar {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.95);
    padding: 10px;
    border-radius: 20px;
    z-index: 30105;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
}

.lb-toolbar-row {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.lb-toolbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

.lb-tool-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-tool-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lb-tool-btn.active {
    background: var(--primary-blue, #00569d);
    box-shadow: 0 0 10px rgba(0, 86, 157, 0.5);
}

.lb-size-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: 0.2s;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}
.lb-size-btn.active {
    background: rgba(255,255,255,0.2);
    border-color: white;
}
.lb-size-btn .dot {
    background: white;
    border-radius: 50%;
}

.lb-color-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: 0.2s;
    padding: 0;
}

.lb-color-btn.active {
    border-color: white;
    transform: scale(1.2);
}

.lb-action-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.lb-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lb-draw-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    font-size: 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-draw-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Responsive & Auto-fitting Top Bar with Fluid Clamp */
.lb-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 14px clamp(10px, 2vw, 20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    z-index: 30100;
}

.lb-header-group {
    display: flex;
    align-items: center;
    gap: clamp(5px, 1.2vw, 12px);
}

.lb-btn,
.lb-close,
.lb-trash,
.lb-ptd,
.lb-download-single,
.lb-draw-btn,
.lb-info-btn {
    background: rgba(255, 255, 255, 0.16);
    color: white;
    border: none;
    width: clamp(39px, 9.8vw, 46px);
    height: clamp(39px, 9.8vw, 46px);
    font-size: clamp(18px, 4.5vw, 21px);
    border-radius: clamp(10px, 2.5vw, 13px);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-decoration: none;
    flex-shrink: 0;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.lb-btn svg,
.lb-close svg,
.lb-trash svg,
.lb-ptd svg,
.lb-download-single svg,
.lb-draw-btn svg,
.lb-info-btn svg {
    width: clamp(20px, 5vw, 23px);
    height: clamp(20px, 5vw, 23px);
}

@media (max-width: 480px) {
    .lb-top-bar {
        padding: 10px 8px;
    }
    .lb-header-group {
        gap: 4px;
    }
    .lb-btn,
    .lb-close,
    .lb-trash,
    .lb-ptd,
    .lb-download-single,
    .lb-draw-btn,
    .lb-info-btn {
        width: clamp(38px, 10.5vw, 41px);
        height: clamp(38px, 10.5vw, 41px);
    }
}
