/* Soldier Detail Modal - Military Memorial Theme */

/* CSS Variables for theme support */
:root {
    --military-navy: #364777;
    --memorial-dark: #2c3e50;
    --honor-gold: #D4AF37;
    --military-tan: #E4D8B4;
    --parchment: #F2EECB;
    --memorial-gray: #6c757d;
}

/* Dark theme overrides */
[data-bs-theme="dark"] {
    --military-tan: #8B7355;
    --parchment: #5C5642;
    --memorial-gray: #adb5bd;
}

/* Modal Overlay */
.soldier-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1050; /* Just above Bootstrap navbar (1030) and dropdown (1000) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.soldier-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Modal Container */
.soldier-modal-container {
    background: var(--bs-body-bg);
    border: 3px solid var(--military-navy);
    border-radius: 12px;
    max-width: 1400px;
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Close Button */
.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--memorial-dark, #2c3e50);
    color: white;
    border: 2px solid var(--honor-gold, #D4AF37);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: var(--honor-gold, #D4AF37);
    color: var(--memorial-dark, #2c3e50);
    transform: rotate(90deg) scale(1.1);
}

/* Header Section */
.modal-header-section {
    background: linear-gradient(135deg, var(--military-navy, #364777) 0%, var(--memorial-dark, #2c3e50) 100%);
    color: white;
    padding: 2rem;
    border-bottom: 3px solid var(--honor-gold, #D4AF37);
    position: relative;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.dogtag-container {
    position: relative;
    flex-shrink: 0;
}

.dogtag-image {
    width: 80px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.dogtag-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Special Elite', monospace;
    font-size: 0.7rem;
    font-weight: bold;
    color: #333;
    text-align: center;
    max-width: 60px;
    line-height: 1.2;
}

.soldier-title h1 {
    font-family: 'Special Elite', monospace;
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.1rem;
}

.soldier-year {
    font-size: 1.1rem;
    margin: 0.5rem 0 0 0;
    opacity: 0.9;
}

.honour-roll-badge {
    margin-top: 0.5rem;
}

.honour-roll-badge .badge {
    font-family: 'Special Elite', monospace;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    letter-spacing: 0.1rem;
}

/* Main Content Section */
.modal-content-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
}

/* Left Column */
.left-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Main Photo */
.main-photo-container {
    background: var(--bs-body-bg);
    border: 3px solid var(--military-tan);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.main-photo {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

.main-badge {
    width: 100%;
    max-width: 300px;
    height: auto;
    display: block;
    margin: 0 auto;
    filter: sepia(20%) contrast(110%);
}

.photo-caption {
    margin-top: 1rem;
    font-style: italic;
    color: var(--bs-secondary-color);
    text-align: center;
}

/* Soldier Details Box */
.soldier-details-box {
    background: var(--bs-body-bg);
    border: 2px solid var(--military-tan);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.detail-item {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--bs-body-color);
}

.detail-item:last-child {
    margin-bottom: 0;
}

.detail-item strong {
    color: var(--military-navy);
    font-family: 'Special Elite', monospace;
}

/* Timeline Container */
.timeline-container {
    background: var(--bs-body-bg);
    border: 2px solid var(--military-tan);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timeline-header {
    font-family: 'Special Elite', monospace;
    color: var(--military-navy, #364777);
    font-size: 1.8rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--military-tan, #E4D8B4);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 3rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--military-navy, #364777), var(--honor-gold, #D4AF37));
}

.timeline-event {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-event.year-marker .timeline-year {
    display: block;
}

.timeline-year {
    display: none;
    font-family: 'Special Elite', monospace;
    font-size: 1.5rem;
    color: var(--military-navy, #364777);
    font-weight: bold;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--parchment, #F2EECB) 0%, var(--military-tan, #E4D8B4) 100%);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 2px solid var(--military-navy, #364777);
    display: inline-block;
}

.timeline-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.timeline-badge {
    position: absolute;
    left: -42px;
    width: 40px;
    height: 40px;
    background: var(--military-navy, #364777);
    border: 3px solid var(--honor-gold, #D4AF37);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.timeline-card {
    flex: 1;
    background: var(--bs-body-bg);
    border: 2px solid var(--military-tan);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.timeline-card:hover {
    box-shadow: 0 4px 12px rgba(54, 71, 119, 0.2);
    transform: translateX(5px);
}

.timeline-card h3 {
    font-family: 'Special Elite', monospace;
    color: var(--bs-body-color);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.event-date {
    color: var(--memorial-gray, #6c757d);
    font-style: italic;
    margin-bottom: 1rem;
}

.event-date i {
    margin-right: 0.5rem;
}

.event-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.detail-badge {
    background: var(--military-navy, #364777);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
}

.event-comment {
    line-height: 1.6;
    color: var(--bs-body-color);
}

/* Glossary tooltip styles for timeline */
.event-comment .glossary-tooltip {
    border-bottom: 1px dotted var(--military-navy, #364777);
    text-decoration: none;
    cursor: help;
    position: relative;
    display: inline;
    color: var(--military-navy, #364777);
    font-weight: 500;
}

.event-comment .glossary-tooltip:hover {
    border-bottom-color: var(--honor-gold, #D4AF37);
    color: var(--memorial-dark, #2c3e50);
}

/* Right Column - Photo Gallery */
.right-column {
    display: flex;
    flex-direction: column;
}

.gallery-header {
    font-family: 'Special Elite', monospace;
    color: var(--military-navy, #364777);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--military-tan, #E4D8B4);
}

/* No Photos Message */
.no-photos-message {
    background: var(--bs-body-bg);
    border: 2px solid var(--military-tan);
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    color: var(--bs-secondary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.no-photos-message p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.no-photos-message .text-muted {
    font-size: 0.9rem;
    font-style: italic;
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    max-height: calc(95vh - 250px);
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom scrollbar for gallery */
.photo-gallery::-webkit-scrollbar {
    width: 8px;
}

.photo-gallery::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.photo-gallery::-webkit-scrollbar-thumb {
    background: var(--military-navy, #364777);
    border-radius: 4px;
}

.photo-gallery::-webkit-scrollbar-thumb:hover {
    background: var(--memorial-dark, #2c3e50);
}

.gallery-item {
    position: relative;
    background: var(--bs-body-bg);
    border: 2px solid var(--military-tan);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px) rotate(1deg);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-color: var(--military-navy, #364777);
}

.gallery-item.is-main {
    border: 3px solid var(--honor-gold, #D4AF37);
}

.gallery-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.main-photo-indicator {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--honor-gold, #D4AF37);
    color: var(--memorial-dark, #2c3e50);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    font-family: 'Special Elite', monospace;
}

.gallery-caption {
    padding: 0.75rem;
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
    font-style: italic;
    line-height: 1.4;
    background: var(--bs-secondary-bg);
}

/* Responsive Design */
@media (max-width: 992px) {
    .modal-content-section {
        grid-template-columns: 1fr;
    }

    .soldier-modal-container {
        max-height: 98vh;
    }

    .modal-header-section {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .soldier-title h1 {
        font-size: 2rem;
    }

    .timeline {
        padding-left: 2rem;
    }

    .timeline::before {
        left: 10px;
    }

    .timeline-badge {
        left: -32px;
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

    .photo-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .soldier-modal-overlay {
        padding: 0.5rem;
    }

    .modal-content-section {
        padding: 1rem;
        gap: 1rem;
    }

    .modal-header-section {
        padding: 1.5rem 1rem;
    }

    .soldier-title h1 {
        font-size: 1.5rem;
    }

    .timeline-header,
    .gallery-header {
        font-size: 1.5rem;
    }

    .timeline-container,
    .soldier-details-box {
        padding: 1rem;
    }

    .modal-close-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .dogtag-image {
        width: 60px;
    }

    .photo-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
    }

    .gallery-item img {
        height: 140px;
    }
}

/* Keyboard Navigation Hint */
.soldier-modal-overlay::after {
    content: 'Press ESC to close';
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: 'Special Elite', monospace;
    pointer-events: none;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .soldier-modal-overlay::after {
        display: none;
    }
}

/* ============================================
   PHOTO LIGHTBOX / CAROUSEL
   ============================================ */

.photo-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1060; /* Just above soldier modal (1050) */
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--memorial-dark, #2c3e50);
    border: 3px solid var(--honor-gold, #D4AF37);
    border-radius: 12px;
    overflow: hidden;
}

/* Close Button */
.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--honor-gold, #D4AF37);
    color: var(--memorial-dark, #2c3e50);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.lightbox-close:hover {
    background: white;
    transform: rotate(90deg) scale(1.1);
}

/* Navigation Arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(212, 175, 55, 0.9);
    color: var(--memorial-dark, #2c3e50);
    border: none;
    border-radius: 4px;
    width: 60px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.lightbox-nav:hover:not(:disabled) {
    background: var(--honor-gold, #D4AF37);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

/* Image Container */
.lightbox-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 3px solid var(--military-tan, #E4D8B4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Image Info */
.lightbox-info {
    background: linear-gradient(135deg, var(--military-navy, #364777) 0%, var(--memorial-dark, #2c3e50) 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-top: 3px solid var(--honor-gold, #D4AF37);
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1.5rem;
    align-items: center;
}

.lightbox-caption {
    flex: 1;
}

.lightbox-caption p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
    line-height: 1.5;
}

.lightbox-caption small {
    font-size: 0.85rem;
    opacity: 0.8;
}

.lightbox-main-badge {
    display: inline-block;
    background: var(--honor-gold, #D4AF37);
    color: var(--memorial-dark, #2c3e50);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    font-family: 'Special Elite', monospace;
    margin-bottom: 0.5rem;
}

.lightbox-counter {
    font-family: 'Special Elite', monospace;
    font-size: 1.1rem;
    color: var(--honor-gold, #D4AF37);
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    white-space: nowrap;
}

.btn-view-full {
    background: var(--honor-gold, #D4AF37);
    color: var(--memorial-dark, #2c3e50);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-family: 'Special Elite', monospace;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-view-full:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Responsive Lightbox */
@media (max-width: 992px) {
    .lightbox-content {
        width: 95%;
        height: 95vh;
    }

    .lightbox-info {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }

    .lightbox-counter,
    .btn-view-full {
        justify-self: center;
    }

    .lightbox-nav {
        width: 50px;
        height: 60px;
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .lightbox-image-container {
        padding: 1rem;
    }

    .lightbox-info {
        padding: 1rem;
    }

    .lightbox-caption p {
        font-size: 1rem;
    }

    .lightbox-nav {
        width: 40px;
        height: 50px;
        font-size: 1.2rem;
    }

    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }

    .lightbox-close {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        top: 0.5rem;
        right: 0.5rem;
    }
}
