/**
 * InSAR Product Detail Page Styles
 * File: static/css/product_detail.css
 * 
 * Styles for displaying InSAR product metadata, maps, citations,
 * and HDF5 v2.0 multi-track information.
 */

/* ============================================
   Base Styles
   ============================================ */

#map { 
    border: 2px solid #333; 
    margin: 20px 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

.container {
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.map-info {
    background: #e7f3ff;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #2196F3;
    border-radius: 4px;
}

.product-section {
    background: white;
    padding: 25px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.coordinate-info {
    font-family: monospace;
    background: #f8f8f8;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
    border: 1px solid #ddd;
    overflow-wrap: break-word;
    font-size: 13px;
}

/* ============================================
   Dataset Overview Section
   ============================================ */

.dataset-overview-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    position: relative;
    overflow: hidden;
}

.dataset-overview-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007bff, #28a745, #ffc107, #dc3545);
    border-radius: 12px 12px 0 0;
}

.dataset-overview-section h4 {
    color: #495057;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dataset-overview-section p {
    margin: 8px 0;
    line-height: 1.5;
    color: #495057;
}

.dataset-overview-section p strong {
    color: #212529;
    min-width: 80px;
    display: inline-block;
}

.dataset-overview-section a {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.dataset-overview-section a:hover {
    background: #007bff;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Special styling for download link */
.dataset-overview-section a[style*="color: #28a745"] {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white !important;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    display: inline-block;
    margin-top: 4px;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.dataset-overview-section a[style*="color: #28a745"]:hover {
    background: linear-gradient(135deg, #218838, #1e9e78);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
}

/* ============================================
   Format Version Badge
   ============================================ */

.format-badge {
    display: inline-block;
    background: #6f42c1;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 10px;
    text-transform: uppercase;
}

.format-badge.v2 {
    background: #28a745;
}

.format-badge.v1 {
    background: #6c757d;
}

/* ============================================
   Multi-Track Display (HDF5 v2.0)
   ============================================ */

.multi-track-section {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    border: 2px solid #0066cc;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 4px 8px rgba(0,102,204,0.15);
}

.multi-track-section h3 {
    color: #0066cc;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid #0066cc;
    padding-bottom: 10px;
}

.track-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.track-card {
    background: white;
    border: 2px solid #b3d9ff;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.track-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #0066cc, #00cc99);
}

.track-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,102,204,0.2);
    border-color: #0066cc;
}

.track-name {
    font-size: 18px;
    font-weight: bold;
    color: #0066cc;
    margin: 0 0 12px 0;
    padding-left: 8px;
}

.track-detail {
    padding: 6px 0 6px 8px;
    border-left: 2px solid #e9ecef;
    margin: 4px 0;
    font-size: 14px;
}

.track-detail strong {
    color: #495057;
    min-width: 120px;
    display: inline-block;
}

.track-detail-value {
    color: #212529;
    font-weight: 500;
}

/* Track metadata expandable section */
.track-metadata-toggle {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.track-metadata-toggle:hover {
    background: #e9ecef;
    border-color: #0066cc;
}

.track-metadata-toggle summary {
    font-weight: 600;
    color: #0066cc;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.track-metadata-toggle summary::before {
    content: '▶';
    display: inline-block;
    transition: transform 0.3s ease;
}

.track-metadata-toggle[open] summary::before {
    transform: rotate(90deg);
}

.track-metadata-content {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #dee2e6;
}

.track-metadata-item {
    background: white;
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 4px;
    font-size: 13px;
    border-left: 3px solid #28a745;
}

/* ============================================
   Enhanced HDF5 Structure Display
   ============================================ */

.hdf5-structure-v2 {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    max-height: 600px;
    overflow-y: auto;
}

.structure-item {
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.structure-item:hover {
    background: #e9ecef;
}

.structure-track {
    color: #0066cc;
    font-weight: bold;
    background: #e6f3ff;
    padding: 6px 10px;
    margin: 8px 0 4px 0;
    border-radius: 4px;
    border-left: 4px solid #0066cc;
}

.structure-group {
    color: #6f42c1;
    font-weight: 600;
    margin-left: 20px;
}

.structure-subgroup {
    color: #fd7e14;
    margin-left: 40px;
}

.structure-dataset {
    color: #28a745;
    margin-left: 60px;
}

.structure-type {
    color: #6c757d;
    font-size: 11px;
    font-style: italic;
}

/* ============================================
   DOI Landing Page Styles
   ============================================ */

.doi-badge {
    display: inline-block;
    background: #ff6600;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 15px;
    text-transform: uppercase;
}

.citation-box {
    background: #f0f8ff;
    border: 2px solid #b0d4f1;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    position: relative;
}

.citation-box::before {
    content: "📋";
    position: absolute;
    top: -10px;
    left: 15px;
    background: white;
    padding: 0 5px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    border: 1px solid #b0d4f1;
}

.citation-box::before:hover {
    background: #007bff;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.citation-box[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -35px;
    left: 15px;
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    animation: tooltipFade 0.3s ease-in;
}

@keyframes tooltipFade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.copy-success {
    position: absolute;
    top: -35px;
    left: 15px;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    animation: successFade 2s ease-in-out;
}

@keyframes successFade {
    0% { opacity: 0; transform: translateY(5px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-5px); }
}

.metadata-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 20px;
}

.metadata-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.metadata-section h4 {
    margin-top: 0;
    color: #007bff;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.doi-landing-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid #f39c12;
}

/* ============================================
   Access Buttons
   ============================================ */

.access-buttons {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.btn-download {
    background: #28a745;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: background-color 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-download:hover {
    background: #218838;
    color: white;
    text-decoration: none;
}

.btn-doi {
    background: #ff6600;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: background-color 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-doi:hover {
    background: #e55a00;
    color: white;
    text-decoration: none;
}

.btn-request-doi {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.btn-request-doi:hover {
    background: #0056b3;
}

/* ============================================
   Technical Metadata
   ============================================ */

.technical-metadata {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.technical-metadata h3 {
    color: #495057;
    margin-top: 0;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

/* License and usage section */
.usage-section {
    background: #e8f5e8;
    border-left: 4px solid #28a745;
    padding: 20px;
    border-radius: 0 8px 8px 0;
    margin: 20px 0;
}

.usage-section h3 {
    color: #155724;
    margin-top: 0;
}

/* ============================================
   Author Display Styles
   ============================================ */

.author-card {
    margin-bottom: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
    transition: background-color 0.3s ease;
}

.author-card:hover {
    background: #e9ecef;
}

.author-name {
    margin: 0;
    font-weight: bold;
    font-size: 16px;
}

.author-name a {
    text-decoration: none;
    color: #007bff;
    transition: color 0.3s ease;
}

.author-name a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.author-affiliation {
    margin: 4px 0 0 0;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.uploader-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-left: 4px solid #28a745;
}

.uploader-info:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.contact-email {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.email-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.email-link:hover {
    background: #007bff;
    color: white;
    text-decoration: none;
    transform: scale(1.02);
}

/* Multiple authors display */
.authors-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.author-separator {
    margin: 8px 0;
    border-top: 1px solid #dee2e6;
}

/* Parsed authors styling */
.parsed-authors-container {
    background: #f0f8ff;
    border: 1px solid #b0d4f1;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.parsed-authors-container h5 {
    margin: 0 0 12px 0;
    color: #1565c0;
    font-size: 16px;
}

.author-item {
    background: white;
    padding: 10px;
    margin: 6px 0;
    border-radius: 6px;
    border-left: 3px solid #2196F3;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
}

.author-item:hover {
    background: #f8f9fa;
    transform: translateX(3px);
}

.authors-count {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    font-style: italic;
}

/* Authors parsing error styling */
.authors-error {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 12px;
    border-radius: 4px;
    margin: 5px 0;
}

/* Publication info styling */
.publication-section {
    margin: 20px 0;
    padding: 15px;
    background: #f0f8ff;
    border-left: 4px solid #2196F3;
    border-radius: 4px;
}

.publication-section h5 {
    margin: 0 0 10px 0;
    color: #1565c0;
}

.publication-content {
    background: white;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #b0d4f1;
}

/* Debug info styling */
.debug-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

/* ============================================
   Map Controls
   ============================================ */

.olControlLayerSwitcher {
    display: none !important;
}

/* ============================================
   Utility Classes
   ============================================ */

.structured-data-indicator {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: #28a745;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0.7;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .metadata-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .access-buttons {
        flex-direction: column;
    }
    
    .btn-download, .btn-doi {
        text-align: center;
        justify-content: center;
    }

    /* Mobile responsive for 3-column layout */
    .product-section div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        display: block !important;
    }
    
    .product-section div[style*="grid-template-columns: 1fr 1fr 1fr"] > div {
        margin-bottom: 20px;
    }
    
    .track-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    /* Tablet responsive - 2 columns */
    .product-section div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }
    
    .product-section div[style*="grid-template-columns: 1fr 1fr 1fr"] > div:last-child {
        grid-column: 1 / -1;
    }
    
    .track-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .citation-box {
        border: 2px solid #000;
        background: white;
    }
    
    .access-buttons, .map-container, #map {
        display: none;
    }
    
    .multi-track-section {
        page-break-inside: avoid;
    }
    
    .track-card {
        page-break-inside: avoid;
    }
}
