/* ================================================
   VARIABLES CSS
   ================================================ */
:root {
    --primary-blue: #4A90E2;
    --secondary-blue: #5BA3F5;
    --light-gray: #f8f9fa;
    --text-gray: #6c757d;
    --border-color: #ddd;
    --shadow-light: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 15px rgba(0,0,0,0.1);
    --transition-standard: all 0.3s ease;
}

/* ================================================
   BASE STYLES
   ================================================ */
body {
    background-color: #f5f5f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
}

/* ================================================
   HEADER STYLES
   ================================================ */
.header-main {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-image {
    max-height: 50px;
    width: auto;
}

.logo-hexagon {
    width: 50px;
    height: 50px;
    background: var(--primary-blue);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.brand-name {
    font-size: 24px;
    font-weight: 500;
    color: #333;
}

.btn-zona-clientes {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 10px 25px;
    font-weight: 500;
    transition: var(--transition-standard);
    border-radius: 4px;
    cursor: pointer;
}

.btn-zona-clientes:hover {
    background: var(--secondary-blue);
    color: white;
    transform: translateY(-2px);
}

/* ================================================
   MAIN CONTAINER
   ================================================ */
.main-container {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-light);
    margin: 30px auto;
    max-width: 1200px;
    overflow: hidden;
}

/* ================================================
   HERO SECTION (PORTADA)
   ================================================ */
.hero-section {
    display: flex;
    align-items: center;
    padding: 40px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.hero-content {
    flex: 1;
    padding-right: 40px;
}

.hero-title {
    color: var(--primary-blue);
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-description {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Hero Image - SOLO para la portada principal */
.hero-section .hero-image {
    flex: 1;
    max-width: 500px;
}

.hero-section .hero-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

/* ================================================
   SEARCH SECTION
   ================================================ */
.search-container {
    display: flex;
    gap: 10px;
    max-width: 400px;
}

.search-input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.btn-buscar {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 12px 30px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-standard);
}

.btn-buscar:hover {
    background: var(--secondary-blue);
    transform: translateY(-2px);
}

/* ================================================
   TRACKING RESULTS
   ================================================ */
.tracking-results {
    display: none;
    padding: 30px;
}

.tracking-results.show {
    display: block;
}

/* ================================================
   INFO CARDS
   ================================================ */
.info-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: var(--transition-standard);
}

.info-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.card-header-custom {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    font-size: 1.1rem;
    text-transform: uppercase;
}

.tracking-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.tracking-id {
    font-size: 0.9rem;
    color: var(--text-gray);
}

.status-badge {
    background: #28a745;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: inline-block;
    font-weight: 500;
}

/* ================================================
   PACKAGE ICONS
   ================================================ */
.package-icons {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 20px;
    flex-wrap: wrap;
}

.package-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-blue);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: var(--transition-standard);
    cursor: pointer;
}

.package-icon:hover {
    transform: scale(1.1);
    background: var(--secondary-blue);
}

/* ================================================
   PHOTO SECTION - Hexágonos decorativos
   ================================================ */
.photo-section {
    text-align: center;
    padding: 20px;
}

.photo-hexagon {
    width: 150px;
    height: 150px;
    background: var(--primary-blue);
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 48px;
    transition: var(--transition-standard);
    cursor: pointer;
}

.photo-hexagon:hover {
    transform: rotate(15deg) scale(1.1);
}

/* ================================================
   PHOTO CONTAINER - Galería de fotos (Viewer.js)
   ================================================ */
.photo-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px 0;
}

/* Contenedor individual de foto */
.photo-container .hero-image {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: var(--light-gray);
    cursor: pointer;
    transition: var(--transition-standard);
    aspect-ratio: 4/3;
}

.photo-container .hero-image:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.photo-container .hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Badge de zoom */
.photo-container .hero-image::after {
    content: '🔍 Click para ampliar';
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.photo-container .hero-image:hover::after {
    opacity: 1;
}

/* Estados de carga */
.photo-container .hero-image.loading {
    position: relative;
}

.photo-container .hero-image.loading img {
    opacity: 0.5;
}

.photo-container .hero-image.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    animation: photo-spin 1s linear infinite;
    z-index: 10;
}

/* Foto cargada */
.photo-container .hero-image.loaded img {
    animation: photo-fadeIn 0.3s ease;
}

/* Error de carga */
.photo-container .hero-image.error::before {
    content: '⚠️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 10;
}

/* Imágenes especiales */
.photo-container .hero-image img[src*="camara.png"],
.photo-container .hero-image img[src*="sin-foto"] {
    opacity: 0.5;
    filter: grayscale(50%);
}

.photo-container .hero-image img[src*="buscando.png"] {
    animation: photo-pulse 2s infinite;
}

/* ================================================
   DETAILS TABLE
   ================================================ */
.details-table {
    width: 100%;
    border-collapse: collapse;
}

.details-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.details-table td:first-child {
    font-weight: 500;
    color: var(--text-gray);
    width: 150px;
}

.details-table tr:last-child td {
    border-bottom: none;
}

/* ================================================
   LOADING ANIMATION
   ================================================ */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading.show {
    display: block;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
    border-style: solid;
    border-color: var(--primary-blue);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner-rotate 1s linear infinite;
}

/* ================================================
   FOOTER
   ================================================ */
.footer {
    text-align: center;
    padding: 20px;
    background: var(--light-gray);
    color: var(--text-gray);
    margin-top: 40px;
}

/* ================================================
   VIEWER.JS CUSTOMIZATION
   ================================================ */
.viewer-backdrop {
    background-color: rgba(0, 0, 0, 0.95) !important;
}

.viewer-button {
    background-color: rgba(74, 144, 226, 0.8) !important;
    border-radius: 4px;
}

.viewer-button:hover {
    background-color: rgba(74, 144, 226, 1) !important;
}

.viewer-toolbar {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

.viewer-navbar {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

.viewer-title {
    color: white !important;
    font-size: 14px !important;
    font-weight: 500;
}

.viewer-transition {
    transition: all 0.3s ease !important;
}

/* ================================================
   ANIMATIONS
   ================================================ */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes photo-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes photo-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes photo-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spinner-rotate {
    to { transform: rotate(360deg); }
}

.animate-slide-in {
    animation: slideInUp 0.5s ease;
}

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */
@media (max-width: 768px) {
    .hero-section {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
    }

    .hero-content {
        padding-right: 0;
        margin-bottom: 30px;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    .search-container {
        max-width: 100%;
        flex-direction: column;
    }

    .photo-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .details-table td:first-child {
        width: 120px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .photo-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .photo-container .hero-image::after {
        font-size: 10px;
        padding: 4px 8px;
    }

    .package-icons {
        gap: 10px;
    }

    .package-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .main-container {
        margin: 15px;
    }
}

/* ================================================
   UTILITY CLASSES
   ================================================ */
.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}