/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: #ffffff;
    color: #1f2937;
    font-size: 16px;
    line-height: 1.6;
}

/* Variables CSS - Fleetguard Theme */
:root {
    --primary-color: #000000;        /* Negro corporativo Fleetguard */
    --primary-dark: #000000;         /* Negro (mismo color) */
    --primary-light: #333333;        /* Gris oscuro */
    --secondary-color: #dc2626;      /* Rojo corporativo */
    --accent-color: #f59e0b;         /* Amarillo/dorado */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --black: #000000;
    --radius: 0.5rem;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Layout */
.min-h-screen {
    min-height: 100vh;
}

.overflow-x-hidden {
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

/* Navigation */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.nav-content {
    display: flex;
    height: 4rem;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    flex-shrink: 0;
    align-items: center;
}

.nav-logo img {
    height: 3rem;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.nav-text {
    display: none;
    align-items: center;
    gap: 2rem;
}

.nav-text span {
    font-size: 0.875rem;
    color: var(--white);
}

@media (min-width: 768px) {
    .nav-text {
        display: flex;
    }
}

/* Hero Section */
.hero {
    position: relative;
    height: 300px;
    overflow: hidden;
    background-color: var(--gray-900);
}

.hero img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (min-width: 640px) {
    .hero {
        height: 400px;
    }
}

@media (min-width: 768px) {
    .hero {
        height: 500px;
    }
}

@media (min-width: 1024px) {
    .hero {
        height: 600px;
    }
}

/* Search Banner */
.search-banner {
    position: relative;
    z-index: 20;
    margin-top: -2rem;
    margin-bottom: 1rem;
}

.search-banner-bg {
    position: absolute;
    inset: 0;
    margin: 0 auto;
    width: 80%;
    border-radius: 9999px;
    background-color: var(--primary-color);
}

.search-banner-content {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
}

.search-banner-text {
    border-radius: 0.5rem;
    padding: 0.5rem 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--white);
    background-color: var(--primary-color);
}

@media (min-width: 640px) {
    .search-banner {
        margin-top: -2.5rem;
    }
    
    .search-banner-bg {
        width: 85%;
    }
    
    .search-banner-content {
        padding: 0.75rem 0;
    }
    
    .search-banner-text {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

@media (min-width: 768px) {
    .search-banner {
        margin-top: -3rem;
    }
    
    .search-banner-bg {
        width: 75%;
    }
    
    .search-banner-text {
        padding: 1rem 2rem;
        font-size: 1.125rem;
    }
}

@media (min-width: 1024px) {
    .search-banner-bg {
        width: 60%;
    }
    
    .search-banner-text {
        padding: 1rem 3rem;
        font-size: 1.25rem;
    }
}

/* Main Content */
.main-content {
    background-color: var(--background, var(--white));
    padding: 2.5rem 0;
}

.search-card {
    background-color: var(--white);
    border-radius: 0.75rem;
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
    margin-bottom: 0.5rem;
    box-shadow: none;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .search-form {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.search-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .search-input-group {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }
}

.search-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-900);
}

.search-container {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    width: 1rem;
    height: 1rem;
    transform: translateY(-50%);
    color: var(--gray-500);
}

.search-input {
    width: 100%;
    height: 2.25rem;
    padding: 0.25rem 0.75rem 0.25rem 2.25rem;
    border: 1px solid var(--gray-200);
    border-radius: 9999px;
    background-color: transparent;
    font-size: 1rem;
    font-weight: 300;
    transition: all 0.15s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

@media (min-width: 640px) {
    .search-input {
        width: 24rem;
    }
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-result-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: var(--gray-50);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .search-actions {
        justify-content: flex-start;
    }
}

.clear-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    gap: 0.375rem;
    border: 1px solid var(--primary-color);
    border-radius: 9999px;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 300;
    color: var(--white);
    background-color: var(--primary-color);
    cursor: pointer;
    transition: all 0.15s ease;
}

.clear-button:hover {
    background-color: rgba(74, 144, 226, 0.9);
}

/* Map and Results Container */
.map-results-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 1024px) {
    .map-results-container {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* Map Container */
.map-container {
    position: relative;
    height: 400px;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    z-index: 10;
}

.map {
    width: 100%;
    height: 100%;
    background-color: #f8f9fa;
}

/* Results */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
}

@media (min-width: 640px) {
    .results-container {
        height: 400px;
    }
}

@media (min-width: 1024px) {
    .results-container {
        height: 400px;
        max-height: 400px;
    }
}

.loading-text {
    color: var(--gray-500);
}

.error-text {
    color: #dc2626;
    text-align: center;
    padding: 2.5rem;
}

/* Location Cards */
.location-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.location-card:active {
    transform: translateY(0);
}

.location-name {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.location-address {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.location-phone {
    color: var(--primary-color);
    font-size: 0.875rem;
}

.location-distance {
    color: var(--primary-green);
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* Footer */
.footer {
    border-top: 1px solid var(--gray-200);
    background-color: var(--gray-50);
    padding: 2rem 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.footer-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    color: var(--gray-900);
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.footer-section p {
    font-size: 0.875rem;
    line-height: 1.625;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--primary-green);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-section a:hover {
    color: var(--primary-green);
    text-decoration: underline;
}

.footer-section .space-y-2 > * + * {
    margin-top: 0.5rem;
}

.footer-section .space-y-3 > * + * {
    margin-top: 0.75rem;
}

.footer-bottom {
    margin-top: 2rem;
    border-top: 1px solid var(--gray-200);
    padding-top: 1.5rem;
}

.footer-bottom p {
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.625;
    color: var(--gray-500);
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .footer {
        padding: 3rem 1rem;
    }
    
    .footer-content {
        gap: 2.5rem;
    }
    
    .footer-bottom {
        margin-top: 3rem;
        padding-top: 2rem;
    }
}

@media (min-width: 768px) {
    .footer-content {
        grid-template-columns: repeat(3, 1fr);
        gap: 3rem;
    }
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .search-form {
        gap: 1rem;
    }
    
    .search-input-group {
        gap: 0.5rem;
    }
    
    .search-input {
        font-size: 0.875rem;
    }
    
    .clear-button {
        width: 100%;
    }
    
    .footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .footer a {
        align-items: center;
        min-height: 44px;
        display: flex;
    }
}

/* Utility classes */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.text-white {
    color: var(--white);
}

.bg-primary {
    background-color: var(--primary-color);
}

.border-primary {
    border-color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Focus styles for accessibility */
.search-input:focus,
.clear-button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Location Button - Mann Filter Style */
.location-button {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.location-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.location-button:active {
    transform: translateY(0);
}

.location-button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.location-button:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Map Custom Styles */
.leaflet-container {
    background-color: #f8f9fa !important;
    font-family: inherit !important;
    z-index: 10 !important;
}

.leaflet-popup-content-wrapper {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
    margin: 8px 12px;
    line-height: 1.4;
    font-family: inherit;
}

.leaflet-popup-tip {
    background: var(--white);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
}

.leaflet-control-attribution {
    display: none !important;
}

.leaflet-control-zoom {
    display: block !important;
}

/* Custom Marker Styles */
.custom-marker-icon {
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
}

.marker-pin {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border: 2px solid var(--white);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    cursor: pointer;
}

.marker-hover .marker-pin {
    transform: scale(1.3);
    background: var(--primary-green);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

/* Leaflet marker hover styles */
.leaflet-interactive {
    cursor: pointer !important;
}

.leaflet-marker-icon {
    cursor: pointer !important;
}

/* Map Popup Styles */
.map-popup {
    font-family: inherit;
    min-width: 200px;
}

.popup-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

.popup-address {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
}

.popup-city {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.popup-phone {
    margin: 0;
}

.popup-phone-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.popup-phone-link:hover {
    color: var(--primary-green);
    text-decoration: underline;
}

/* Map Loading State */
.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background-color: #f8f9fa;
    color: var(--gray-500);
}

/* Server Required Message */
.server-required-message {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 1rem;
    border: 2px dashed var(--gray-300);
}

.message-content {
    text-align: center;
    max-width: 500px;
}

.message-content h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.message-content p {
    color: var(--gray-600);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.server-instructions {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
    margin-top: 1rem;
}

.server-instructions h4 {
    color: var(--gray-700);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.code-block {
    background: var(--gray-900);
    color: var(--white);
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
}

.code-block code {
    background: none;
    color: inherit;
    padding: 0;
}

.server-instructions a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.server-instructions a:hover {
    text-decoration: underline;
}

/* Print styles */
@media print {
    .nav,
    .search-banner,
    .search-card,
    .map-container {
        display: none;
    }
    
    .main-content {
        padding: 0;
    }
    
    .location-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .map-results-container {
        grid-template-columns: 1fr;
    }
}
