/* Reset CSS și Variabile */
:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #2ecc71;
    --secondary-dark: #27ae60;
    --gray-light: #f5f5f5;
    --gray: #e0e0e0;
    --gray-dark: #888;
    --text-color: #333;
    --text-light: #666;
    --white: #fff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--gray-light);
}

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

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

.hidden {
    display: none !important;
}

/* Butoane */
button {
    cursor: pointer;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 10px 20px;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px 16px;
}

.btn-secondary:hover {
    background-color: var(--gray-light);
}

.btn-social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius);
    margin: 0 5px;
    color: var(--white);
    text-decoration: none;
}

.facebook {
    background-color: #1877f2;
}

.twitter {
    background-color: #1da1f2;
}

.whatsapp {
    background-color: #25d366;
}

/* Header */
header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
}

header h1 a {
    color: var(--primary-color);
    text-decoration: none;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    color: var(--text-color);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: var(--radius);
}

nav ul li a.active, nav ul li a:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Secțiunea hero cu formular */
.hero {
    padding: 50px 0;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: var(--white);
    text-align: center;
}

.hero h2 {
    margin-bottom: 30px;
    font-size: 2rem;
}

.search-form {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 15px;
    box-shadow: var(--shadow);
}

.input-group {
    flex: 1;
    min-width: 200px;
    position: relative;
    margin: 10px;
}

.input-group i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-dark);
}

.input-group input {
    width: 100%;
    padding: 10px 10px 10px 35px;
    border: 1px solid var(--gray);
    border-radius: var(--radius);
    font-size: 1rem;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

#swap-button {
    background-color: var(--white);
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 5px;
    box-shadow: var(--shadow);
}

#swap-button:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

#calculate-button {
    margin: 10px;
}

/* Secțiunea de rezultate */
.results {
    padding: 40px 0;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: 3fr 2fr;
    }
}

.map-container {
    position: relative;
    height: 500px !important; /* Înălțime fixă mai mare */
    width: 100% !important;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    visibility: visible !important;
    display: block !important;
}

#map {
    width: 100% !important;
    height: 100% !important;
}

/* Butonul de fullscreen pentru hartă */
.fullscreen-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.fullscreen-button i {
    color: var(--text-color);
}

/* Stilul pentru modul fullscreen */
.map-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
}

.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

.info-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-card {
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.info-card h4 {
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 1px solid var(--gray);
    padding-bottom: 8px;
}

.info-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.info-item i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-right: 15px;
    width: 30px;
    text-align: center;
}

.info-item div {
    display: flex;
    flex-direction: column;
}

.info-item span {
    color: var(--text-light);
    font-size: 0.9rem;
}

.info-item strong {
    font-size: 1.1rem;
}

.conversions-table {
    width: 100%;
    border-collapse: collapse;
}

.conversions-table th {
    text-align: left;
    padding: 8px;
    border-bottom: 2px solid var(--gray);
    color: var(--text-light);
    font-weight: 600;
}

.conversions-table td {
    padding: 8px;
    border-bottom: 1px solid var(--gray);
}

/* Secțiunea de eroare */
.error-section {
    padding: 40px 0;
}

.error-message {
    text-align: center;
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
}

.error-message i {
    font-size: 3rem;
    color: #e74c3c;
    margin-bottom: 15px;
}

.error-message h3 {
    margin-bottom: 15px;
}

.error-message p {
    margin-bottom: 20px;
    color: var(--text-light);
}

/* Secțiunea About */
.about {
    padding: 60px 0;
    background-color: var(--white);
}

.about h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.about p {
    max-width: 800px;
    margin: 0 auto 20px;
    text-align: center;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature {
    text-align: center;
    padding: 20px;
    background-color: var(--gray-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.feature:hover {
    transform: translateY(-5px);
}

.feature i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.feature h3 {
    margin-bottom: 10px;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: var(--white);
    padding: 40px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 20px;
}

.footer-logo h2 {
    margin-bottom: 10px;
}

.footer-links h3, .footer-contact h3 {
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.footer-links h3:after, .footer-contact h3:after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 50px;
    height: 2px;
    background-color: var(--primary-color);
}

.footer-links ul {
    list-style: none;
}

.footer-links ul li {
    margin-bottom: 8px;
}

.footer-links ul li a {
    color: #bdc3c7;
    transition: var(--transition);
}

.footer-links ul li a:hover {
    color: var(--primary-color);
}

.footer-contact p {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.footer-contact p i {
    margin-right: 10px;
}

.social-links {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #34495e;
    color: var(--white);
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

.footer-bottom {
    border-top: 1px solid #34495e;
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #bdc3c7;
}

.attribution a {
    color: #bdc3c7;
    text-decoration: underline;
}

/* Dialog modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--white);
    margin: 10% auto;
    padding: 25px;
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    color: var(--gray-dark);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal h2 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.modal p {
    margin-bottom: 15px;
}

.share-link {
    display: flex;
    margin-bottom: 20px;
}

.share-link input {
    flex: 1;
    border: 1px solid var(--gray);
    border-radius: var(--radius) 0 0 var(--radius);
    padding: 10px;
}

.share-link button {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.social-share {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .search-form {
        flex-direction: column;
    }
    
    .input-group {
        width: 100%;
        margin: 5px 0;
    }
    
    #swap-button {
        margin: 10px;
        transform: rotate(90deg);
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-bottom p {
        margin-bottom: 10px;
    }
}

/* Stiluri pentru butonul "Reset" */
#reset-button {
    margin: 10px;
    background-color: #e74c3c;
    color: white;
    border: none;
}

#reset-button:hover {
    background-color: #c0392b;
}

/* Adăugări pentru stiluri CSS */

/* Stiluri pentru indicatorul de progres */
.progress-bar-container {
    width: 80%;
    max-width: 300px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin: 10px auto 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

/* Stiluri pentru indicatorul de rută estimată */
.route-actions {
    display: flex;
    align-items: center;
}

.route-accuracy {
    margin-right: 15px;
    background-color: #f39c12;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Stiluri pentru butonul de inversare locații */
.btn-icon {
    background-color: var(--white);
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 10px;
    box-shadow: var(--shadow);
    cursor: pointer;
    border: 1px solid var(--gray);
}

.btn-icon:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Stiluri pentru opțiunile de eroare */
.error-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

#use-estimate-button {
    background-color: #f39c12;
    color: white;
    border: none;
}

#use-estimate-button:hover {
    background-color: #e67e22;
}

/* Stiluri responsive pentru butoanele din formular */
@media (max-width: 768px) {
    #swap-button {
        transform: rotate(90deg);
        margin: 15px auto;
    }
    
    .error-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .route-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .route-accuracy {
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* Butonul de fullscreen pentru hartă - EVIDENȚIAT */
.fullscreen-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background-color: #3498db; /* Culoare albastră evidentă */
    color: white;
    border: none;
    border-radius: 4px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.fullscreen-button:hover {
    background-color: #2980b9;
    transform: scale(1.1);
}

.fullscreen-button i {
    color: white;
    font-size: 1.1rem;
}

/* Dimensiune mai mare pe mobil */
@media (max-width: 768px) {
    .fullscreen-button {
        width: 44px;
        height: 44px;
    }
    
    .fullscreen-button i {
        font-size: 1.3rem;
    }
}

/* Stiluri pentru tooltip-ul de hartă - versiunea clasică */
.map-tooltip {
    position: absolute;
    top: 10px;
    right: 56px; /* Poziționat lângă butonul de fullscreen */
    background-color: white; /* Fundal alb */
    color: #333; /* Text închis */
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px; /* Font mai mic */
    font-weight: normal;
    z-index: 999;
    pointer-events: none; /* Pentru a nu bloca interacțiunile cu harta */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 180px;
    text-align: center;
    white-space: nowrap;
    border: 1px solid #e0e0e0; /* Bordură subtilă */
}

/* Stilul pentru săgeata/vârful tooltip-ului */
.map-tooltip:after {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    border-width: 5px 0 5px 5px;
    border-style: solid;
    border-color: transparent transparent transparent white;
}

/* Clasa adăugată prin JavaScript pentru a face tooltip-ul vizibil */
.map-tooltip.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Ajustări responsive pentru ecrane mici */
@media (max-width: 768px) {
    .map-tooltip {
        top: 56px; /* Sub butonul de fullscreen pe mobil */
        right: 10px;
        max-width: 140px;
        white-space: normal; /* Permitem ruperea textului pe mai multe linii */
        text-align: right;
        font-size: 11px; /* Font și mai mic pe mobil */
    }
    
    .map-tooltip:after {
        top: -6px;
        right: 13px;
        transform: none;
        border-width: 0 5px 5px 5px;
        border-color: transparent transparent white transparent;
    }
}

/* Ajustări pentru titlul principal */
.hero h2 {
    margin-bottom: 25px;
    font-size: 1.8rem;
    line-height: normal;
}

/* Ajustare responsivă pentru titlu pe mobil */
@media (max-width: 768px) {
    .hero h2 {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }
}

/* Modificare proporții pentru rezultate */
@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr 2fr; /* 1/3 pentru sumar, 2/3 pentru hartă */
    }
}

/* Ajustări pentru textul de rezultate */
.results-header h3 {
    font-size: 1rem;
    font-weight: normal;
    line-height: normal;
    margin-bottom: 15px;
}

.results-header h3 span {
    font-weight: bold;
}

/* Stilizare pentru ruta titlu */
#route-title {
    font-weight: bold;
}

/* Ajustări pentru sumarul călătoriei */
.info-card {
    padding: 16px;
}

.info-card h4 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.info-item {
    margin-bottom: 12px;
}

/* Ajustare pentru harta mai mare */
.map-container {
    height: 550px !important; /* Înălțime mărită pentru hartă */
}

/* Corectarea centrării textului de rezultate */
.results-header {
    display: block;
    text-align: center;
}

/* Îmbunătățiri pentru modul fullscreen */
.fullscreen-active main > section:not(.results),
.fullscreen-active footer {
    display: none !important;
}

.fullscreen-active .results .container {
    max-width: 100%;
    padding: 0;
}

.fullscreen-active .results-header,
.fullscreen-active .info-container {
    display: none !important;
}

.fullscreen-active .results {
    padding: 0;
}

.fullscreen-active .results-grid {
    display: block;
    gap: 0;
}

.map-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
}

/* Păstrăm stilul butonului albastru și în modul fullscreen */
.fullscreen-active .fullscreen-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background-color: #3498db; /* Păstrăm culoarea albastră */
    color: white;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 10000;
}

/* Asigurăm că iconița din buton rămâne albă */
.fullscreen-active .fullscreen-button i {
    color: white;
    font-size: 1.2rem;
}