/* --- 1. Global Setup & Variables --- */
:root {
    --color-primary: #E9967A; /* Dark Salmon */
    --color-primary-rgb: 233, 150, 122; /* RGB for Dark Salmon */
    --color-accent: #7A7AE9;   /* Split Complementary Blue */
    --color-text: #333333;
    --color-background: #FDFBFB;
    --color-footer-bg: #7A7AE9;
    --color-monochromatic: #D06744;
    --color-primary-light: #fef5f2;
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Lato', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-background);
    line-height: 1.6;
    font-size: 18px;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 700;
}

section h2 {
    font-size: 2.5rem;
    color: var(--color-primary);
    text-align: center;
    margin-bottom: 40px;
}

.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.intro-text {
    text-align: center;
    max-width: 750px;
    margin: 0 auto 50px auto; /* Centers the block and adds space below */
    font-size: 1.1rem;
    line-height: 1.7;
}

h3.intro-text {
    font-size: 1.8rem; 
    font-weight: 700; 
    line-height: 1.4; 
    color: var(--color-text); 
}

.info-text {
    flex: 1;
    min-width: 0; 
}

.form-container input,
.form-container textarea,
.form-container select,
.form-card input,
.form-card textarea,
.form-card select {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: var(--font-body);
    background-color: #f8f9fa;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-container input:hover,
.form-container textarea:hover,
.form-container select:hover,
.form-card input:hover,
.form-card textarea:hover,
.form-card select:hover {
    border-color: #a0a0a0;
}

.form-container input:focus,
.form-container textarea:focus,
.form-container select:focus,
.form-card input:focus,
.form-card textarea:focus,
.form-card select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2);
}

.mobile-instruction-text {
    display: none;
}

.slider-nav-buttons {
    display: none;
}

/* --- 2. Header & Navigation --- */
.main-header {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: rgba(253, 251, 251, 0.9);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 0.5rem 0;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-container img {
    max-height: 50px;
    width: auto;
}

.logo-container {
    text-decoration: none;
}

.company-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--color-primary);
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 25px;
}

.main-nav a {
    text-decoration: none;
    color: var(--color-text);
    font-weight: 700;
    transition: color 0.3s;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--color-accent);
}

.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.hamburger-line {
    width: 30px;
    height: 3px;
    background-color: var(--color-primary);
    border-radius: 10px;
    transition: all 0.3s ease-in-out;
}

/* --- 3. Hero Section --- */
.hero-section {
    height: 100vh; 
    background-image: url('/photos/index_hero.webp');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    padding: 0 20px;
    padding-top: 80px; 
}

.hero-text {
    background-color: rgba(0, 0, 0, 0.5); /* Dark overlay for text readability */
    padding: 2rem 3rem;
    border-radius: 10px;
}

.hero-text h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.hero-text p {
    font-size: 1.2rem;
}

/* --- 4. Values Section --- */
.values-section {
    padding-top: 80px;
    padding-bottom: 20px;
    padding-left: 20px;
    padding-right: 20px;
    background-color: var(--color-background);
}

.value-item {
    display: flex;
    align-items: center;
    gap: 50px;
    margin-bottom: 60px;
}

.value-item.reverse-layout {
    flex-direction: row-reverse;
}

.value-image {
    flex: 1; /* Each part takes up equal space */
    min-width: 0;
}

.value-image img {
    width: 100%;
    height: 350px;
    object-fit: cover; 
    display: block;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.value-text {
    flex: 1;
}

.value-text h3 {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* --- 5. Facts Section --- */
.facts-section {
    padding-top: 20px;
    padding-bottom: 20px;   
    padding-left: 20px;
    padding-right: 20px;
    background-color: var(--color-primary-light);
}

.facts-grid {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.fact-item {
    width: 350px;
    height: 350px;
    perspective: 1000px;
    cursor: pointer;
}

.slider-nav-buttons {
    display: none;
}

.fact-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-radius: 12px;
}

.fact-item.is-flipped .fact-card-inner {
    transform: rotateY(180deg);
}

.fact-item .fact-card-front,
.fact-item .fact-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
}

.fact-card-front {
    position: relative; 
}

.fact-card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fact-card-back {
    background-color: var(--color-primary);
    color: white;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.fact-card-back h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.fact-card-back p {
    font-size: 1.1rem;
}

.flip-icon {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    z-index: 5;
}

.fact-item:hover .flip-icon {
    opacity: 1;
    transform: scale(1);
}

/* --- 6. Call to Action Section --- */
.cta-section {
    padding-top: 20px;
    padding-bottom: 20px;   
    padding-left: 20px;
    padding-right: 20px;
    background-color: var(--color-background);
}

.cta-layout {
    display: flex;
    align-items: center;
    gap: 60px;
}

.cta-image-container {
    flex: 1; 
    max-width: 500px;
}

.cta-image-container img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.cta-text-container {
    flex: 1; 
    text-align: left;
}

.cta-description {
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.7;
}

.cta-button {
    display: inline-block;
    background-color: var(--color-primary);
    color: #FFFFFF;
    padding: 15px 35px;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 50px;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.cta-button:hover {
    background-color: #D06744;
    transform: translateY(-3px);
}

/* --- 7. Proposed Routes Section --- */
.proposed-routes-section {
    padding-top: 20px;
    padding-bottom: 20px;   
    padding-left: 20px;
    padding-right: 20px;
    background-color: var(--color-primary-light);
}

.routes-layout {
    display: flex;
    align-items: center;
    gap: 50px;
}

.routes-description {
    flex: 1; 
    max-width: 500px;
}

.routes-description p {
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.7;
}

.routes-map {
    flex: 1; 
}

.routes-map iframe {
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* --- 8. Contact Section --- */
.hero-contact-section {
    padding: 120px 20px;
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('/photos/penasco_sign.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #FFFFFF;
    text-align: center;
}

.hero-contact-section .intro-text {
    color: #f1f1f1;
}

.contact-button-group {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid #FFFFFF;
    color: #FFFFFF;
    padding: 12px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
}

.contact-btn:hover {
    background-color: #FFFFFF;
    color: var(--color-text);
    transform: translateY(-3px);
}

.contact-btn svg {
    margin-right: 10px;
}

/* --- 9. Map Intro Section --- */

.hero-section--map {
    background-image: url('/photos/map_hero.webp');
}

.map-intro-section {
    padding-top: 80px;
    padding-bottom: 20px;   
    padding-left: 20px;
    padding-right: 20px;
    background-color: var(--color-background);
}

.map-intro-layout {
    display: flex;
    align-items: center;
    gap: 60px;
}

.map-intro-text {
    flex: 1;
}

.map-intro-text h3 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    color: var(--color-primary);
}

.map-intro-image {
    flex: 1;
    max-width: 500px;
}

.map-intro-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* --- 10. Map Form Section --- */
.map-form-section {
    padding-top: 20px;
    padding-bottom: 20px;   
    padding-left: 20px;
    padding-right: 20px;
    background-color: var(--color-primary-light);
}

#map {
    width: 100%;
    height: 500px;
    border-radius: 12px;
    margin-bottom: 40px;
    border: 1px solid #ddd;
}

/* Form Styles */
.form-container {
    max-width: 700px;
    margin: 0 auto;
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.form-container label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

.form-container input[type="text"],
.form-container textarea,
.form-container select {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: var(--font-body);
    background-color: #f8f9fa;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-container input[type="text"]:hover,
.form-container textarea:hover,
.form-container select:hover {
    border-color: #a0a0a0;
}

.form-container input[type="text"]:focus,
.form-container textarea:focus,
.form-container select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2);
}

.form-buttons {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.form-buttons .cta-button {
    flex-grow: 1;
}

.secondary-button {
    flex-grow: 1;
    padding: 15px 35px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    border: 2px solid var(--color-text);
    background-color: transparent;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-button:hover {
    background-color: var(--color-text);
    color: #ffffff;
}

/* --- 11. Rutas Section --- */
.hero-section--rutas {
    background-image: url('/photos/rutas_hero.webp');
}

.route-intro-section {
    padding-top: 80px;
    padding-bottom: 20px;   
    padding-left: 20px;
    padding-right: 20px;
    background-color: var(--color-background);
}

.route-map-container {
    max-width: 1000px;
    margin: 0 auto; 
}

.route-map-container iframe {
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.route-details-section {
    padding-top: 20px;
    padding-bottom: 20px;   
    padding-left: 20px;
    padding-right: 20px;
    background-color: var(--color-primary-light);
}

.value-image img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* --- 12. Login Section --- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 100px 20px 20px 20px; 
    background-color: #f8f9fa; 
}

.login-form {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.login-form h2 {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: var(--font-body);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2);
}

.login-form .cta-button {
    width: 100%; /* Make button full-width */
    margin-top: 10px;
}

.login-error {
    display: none; /* Hidden by default */
    padding: 10px;
    margin-bottom: 20px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
}

/* --- 13. Dashboard Section --- */
.dashboard-main {
    background-color: #f8f9fa; /* Light background for the whole page */
    padding-top: 80px; /* Space for the fixed header */
    min-height: 100vh;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 30px;
}

.dashboard-header h2 {
    margin: 0;
    text-align: left;
}

.logout-btn {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 50px;
    border: 2px solid var(--color-text);
    background-color: transparent;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background-color: var(--color-text);
    color: #ffffff;
}

.dashboard-section {
    margin-bottom: 40px;
}

.dashboard-section h3 {
    color: var(--color-text); /* Black/charcoal for these headings */
    margin-bottom: 20px;
    text-align: center;
}

.form-card {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    max-width: 600px;
    margin: 0 auto; 
}

.form-grid {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.time-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-inputs select {
    width: 100%;
}

.time-inputs span {
    font-weight: 700;
}

.form-display-field {
    width: 100%;
    padding: 12px;
    background-color: #e9ecef;
    border: 1px solid #ccc;
    border-radius: 6px;
    min-height: 47px; 
}

#rideForm .cta-button {
    width: 100%;
    margin-top: 10px;
}

/* --- 14. Ride Records Section --- */
.ride-records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.ride-card h4 {
    color: var(--color-primary);
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.ride-card p {
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.submission-timestamp {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* --- 15. Footer --- */
.main-footer {
    background-color: var(--color-footer-bg);
    color: var(--color-background);
    text-align: center;
    padding: 20px 0;
}

.main-footer a {
    color: var(--color-primary);
    text-decoration: none; 
    margin: 0 5px;
    font-weight: 700;
    transition: text-decoration 0.3s ease;
}

.main-footer a:hover {
    text-decoration: underline;
}

/* --- 16. Mobile Responsiveness --- */
@media (max-width: 768px) {

    /* --- Global Mobile Adjustments --- */
    section h2 {
        margin-bottom: 40px;
        font-size: 2rem;
    }
    
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .hero-text h2 {
        font-size: 1.1rem;
    }

    .main-nav.is-open ~ .hamburger-btn .hamburger-line {
        background-color: var(--color-accent);
    }
    
    /* --- Header & Navigation --- */
    .company-name {
        font-size: 0.85rem;
    }

    .main-nav.is-open ~ .hamburger-btn .hamburger-line:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .main-nav.is-open ~ .hamburger-btn .hamburger-line:nth-child(2) {
        opacity: 0;
    }
    .main-nav.is-open ~ .hamburger-btn .hamburger-line:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    .hamburger-btn {
        display: flex;
    }
    
    .hamburger-line {
        background-color: var(--color-primary);
    }
    
    .main-nav {
        display: none;
        position: absolute;
        top: 69px;
        left: 0;
        width: 100%;
        background-color: rgba(253, 251, 251, 0.98);
        backdrop-filter: blur(5px);
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
    
    .main-nav.is-open {
        display: flex;
    }
    
    .main-nav ul {
        width: 100%;
        flex-direction: column;
        align-items: center;
        padding: 10px 0;
    }
    
    .main-nav li {
        width: 100%;
        text-align: center;
    }
    
    .main-nav a {
        display: block;
        padding: 8px 0;
        width: 100%;
    }

    /* --- Index Page Sections --- */    
    .value-item, .value-item.reverse-layout {
        flex-direction: column;
        text-align: center;
    }

    .facts-section .content-container {
        position: relative;
        padding-left: 0;
        padding-right: 0;
    }

    .facts-slider-wrapper {
        position: relative;
        overflow: hidden;
        width: 100%;
        height: 350px; 
    }

    .facts-grid {
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 0;
        transition: transform 0.5s ease-in-out;
    }

    .fact-item {
        width: 100%;
        flex-shrink: 0;
        box-sizing: border-box; 
        padding: 0 20px; 
    }

    .mobile-instruction-text {
        display: block;
        text-align: center;
        margin-top: -40px;
        margin-bottom: 50px;
        font-style: italic;
        color: #6c757d;
    }

    .slider-btn {
        background-color: var(--color-primary);
        color: white;
        border: none;
        pointer-events: auto; 
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        border-radius: 50%;
        width: 44px;
        height: 44px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.3s ease;
    }

    .slider-nav-buttons {
        display: block;
    }
    
    .slider-btn:hover {
        background-color: var(--color-monochromatic);
    }

    .slider-btn.prev-btn {
        left: 10px;
    }

    .slider-btn.next-btn {
        right: 10px;
    }
    
    .cta-layout {
        flex-direction: column;
        gap: 40px;
    }

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

    .contact-button-group {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .hero-contact-section {
        background-attachment: scroll; 
    }

    /* --- Mapa Page Sections --- */
    .map-intro-layout {
        flex-direction: column;
        text-align: center;
    }
    .form-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    /* --- Rutas Page Sections --- */
    .routes-layout {
        flex-direction: column-reverse;
        text-align: center;
    }

    /* --- Dashboard Page Sections --- */
    .time-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}