:root {
    --primary-color: #D4722C;
    --primary-hover: #bf5f1e;
    --background-dark: #FAF0E6;
    --surface-dark: #FFFFFF;
    --text-white: #1B3A4B;
    --text-gray: #4a6274;
    --glass-background: rgba(27, 77, 92, 0.03);
    --glass-border: rgba(27, 77, 92, 0.1);
    --accent-glow: rgba(212, 114, 44, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--background-dark);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
}

.bg-gradient {
    display: none;
}

.hidden { display: none !important; }

/* --- Container & Header --- */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    animation: fadeIn 0.6s ease-out;
}

/* Old header/nav removed - using shared navbar from /sitio/style.css */

/* --- Hero --- */
.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #1B4D5C;
}

.hero p {
    color: var(--text-gray);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Stats --- */
.ref-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.ref-stat {
    background: var(--surface-dark);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 24px;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 2px 12px rgba(27, 77, 92, 0.08);
}

.ref-stat .stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.ref-stat .stat-label {
    font-size: 0.8rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* --- Mapa --- */
.map-section {
    margin-bottom: 2.5rem;
}

.map-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-title i {
    color: var(--primary-color);
}

.map-subtitle {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.delivery-map {
    height: 400px;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    z-index: 1;
}

.map-stats {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.map-stat-pill {
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    padding: 6px 16px;
    font-size: 0.8rem;
    color: var(--text-gray);
    backdrop-filter: blur(10px);
}

.map-stat-pill strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* Leaflet cluster custom styles */
.marker-cluster-custom {
    background: transparent !important;
}

.cluster-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 3px 12px rgba(212, 114, 44, 0.4);
    border: 3px solid #fff;
}

.cluster-small {
    width: 36px; height: 36px;
    font-size: 0.8rem;
    background: var(--primary-color);
}

.cluster-medium {
    width: 44px; height: 44px;
    font-size: 0.95rem;
    background: #c0571a;
}

.cluster-large {
    width: 52px; height: 52px;
    font-size: 1.1rem;
    background: #a34815;
}

/* Leaflet custom marker */
.delivery-pin {
    color: var(--primary-color);
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    line-height: 1;
}

/* Leaflet popup override */
.leaflet-popup-content-wrapper {
    background: #1B4D5C !important;
    color: #fff !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
}

.leaflet-popup-tip {
    background: #1B4D5C !important;
}

.leaflet-popup-content {
    font-family: 'Outfit', sans-serif !important;
    font-size: 0.9rem !important;
    margin: 10px 14px !important;
}

.popup-city {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 2px;
}

.popup-state {
    font-size: 0.8rem;
    color: #9ec5d0;
    margin-bottom: 2px;
}

.popup-count {
    color: #FF8E41;
    font-weight: 600;
}

@media (max-width: 640px) {
    .delivery-map {
        height: 300px;
        border-radius: 16px;
    }
}

/* --- CTA --- */
.ref-cta {
    text-align: center;
    margin-bottom: 2.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--background-dark);
    padding: 14px 32px;
    border-radius: 9999px;
    box-shadow: 0 4px 20px rgba(255, 142, 65, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(255, 142, 65, 0.4);
}

.btn-subtle {
    background: var(--glass-background);
    color: var(--text-gray);
    padding: 12px 24px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.btn-subtle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

/* --- Form Card --- */
.ref-form-card {
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 2.5rem;
    backdrop-filter: blur(20px);
}

.ref-form-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    color: var(--text-gray);
    font-size: 0.9rem;
}

input[type="text"],
textarea {
    background: var(--surface-dark);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    width: 100%;
    margin-bottom: 16px;
    transition: var(--transition);
    outline: none;
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: #7a9aab;
}

input[type="text"]:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* --- Stars --- */
.rating-stars {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.rating-stars i {
    font-size: 1.8rem;
    color: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
}

.rating-stars i.active {
    color: #f59e0b;
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.4));
}

.rating-stars i:hover {
    transform: scale(1.15);
}

/* --- Photo Upload --- */
.photo-upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 16px;
}

.photo-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--accent-glow);
}

.photo-upload-area i.fa-camera {
    font-size: 2rem;
    color: var(--text-gray);
    margin-bottom: 8px;
}

.photo-upload-area p {
    color: var(--text-gray);
    font-size: 0.9rem;
}

/* --- Photo Preview Grid (form) --- */
.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.photo-preview-item {
    aspect-ratio: 1;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    position: relative;
    border: 1px solid var(--glass-border);
}

.photo-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.photo-remove-btn:hover {
    background: #ef4444;
    transform: none;
}

.photo-add-btn {
    aspect-ratio: 1;
    border-radius: 12px;
    border: 2px dashed var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-gray);
    font-size: 1.5rem;
    transition: var(--transition);
}

.photo-add-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* --- Form Actions --- */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* --- Reference Grid --- */
.ref-grid {
    display: grid;
    gap: 24px;
}

/* --- Reference Card --- */
.ref-card {
    background: var(--surface-dark);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(27, 77, 92, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.ref-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(27, 77, 92, 0.12);
    border-color: rgba(212, 114, 44, 0.2);
}

.ref-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.ref-card-header img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.ref-card-header .ref-author { flex: 1; }

.ref-card-header .ref-author-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-white);
}

.ref-card-header .ref-date {
    font-size: 0.8rem;
    color: var(--text-gray);
}

.ref-city {
    color: var(--primary-color);
    font-weight: 500;
}

.ref-city i {
    font-size: 0.7rem;
    margin-right: 3px;
}

.ref-card-stars {
    margin-bottom: 10px;
}

.ref-card-stars i {
    color: #f59e0b;
    font-size: 0.95rem;
}

.ref-card-stars i.empty {
    color: rgba(255, 255, 255, 0.15);
}

.ref-card-text {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 16px;
    color: var(--text-gray);
}

.ref-card-photo {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 16px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.ref-card-photo:hover {
    opacity: 0.88;
}

/* --- Photos Grid (card) --- */
.ref-photos-grid {
    display: grid;
    gap: 6px;
    border-radius: 16px;
    overflow: hidden;
}

.ref-photos-2 { grid-template-columns: 1fr 1fr; }
.ref-photos-3 { grid-template-columns: 1fr 1fr; }
.ref-photos-3 .ref-grid-photo:first-child { grid-row: span 2; }
.ref-photos-4 { grid-template-columns: 1fr 1fr; }
.ref-photos-5 { grid-template-columns: 1fr 1fr 1fr; }
.ref-photos-5 .ref-grid-photo:nth-child(1),
.ref-photos-5 .ref-grid-photo:nth-child(2) { grid-column: span 1; }

.ref-grid-photo {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s ease;
    border-radius: 4px;
}

.ref-grid-photo:hover {
    opacity: 0.85;
}

/* --- Pending Badge --- */
.ref-card-pending {
    border-color: rgba(255, 142, 65, 0.25);
    opacity: 0.85;
}

.pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 14px;
    background: var(--accent-glow);
    color: var(--primary-color);
    border: 1px solid rgba(255, 142, 65, 0.2);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* --- Empty & Loading States --- */
.ref-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-gray);
}

.ref-empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.ref-empty p {
    font-size: 1.05rem;
}

.ref-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-gray);
}

.ref-loading .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(27, 58, 75, 0.9);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
    padding: 20px;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
}

/* --- Footer --- */
.ref-footer {
    margin-top: 3rem;
    text-align: center;
    opacity: 0.4;
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--text-gray);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(27, 58, 75, 0.7);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-content {
    background: var(--surface-dark);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 3rem 2.5rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    animation: modalIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--background-dark);
    position: relative;
}

.modal-icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
    z-index: -1;
}

.modal-content p {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-white);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(2); opacity: 0; }
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* --- Responsive --- */
@media (max-width: 640px) {
    .container {
        padding: 1.25rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 0.95rem;
    }

    .ref-form-card {
        padding: 20px;
        border-radius: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .ref-card {
        padding: 16px;
        border-radius: 16px;
    }

    .ref-stats {
        gap: 10px;
    }

    .ref-stat {
        padding: 12px 16px;
        min-width: 90px;
    }

    .logo-img {
        height: 40px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
