/* CSS Reset and Basic Setup */
:root {

    /* DARK THEME (DEFAULT) */
    --background-dark: #040f1a;
    --text-color-primary: #eff1f3;
    --text-color-secondary: rgba(239, 241, 243, 0.65);
    --glass-bg: rgba(18, 38, 58, 0.5);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
    --blur-intensity: 16px;

    /* Colors */
    --transaf-orange: #f58220;
    --primary-glow: var(--transaf-orange);

    /* Status Colors */
    --danger-color: #e53e3e;
    --success-color: #38a169;
    --warning-color: #dd6b20;

    /* Dimensions */
    --sidebar-width-collapsed: 92px;
    --sidebar-width-expanded: 260px;
}

/* LIGHT THEME */
[data-theme='light'] {
    --background-dark: #f0f2f5;
    --text-color-primary: #1a202c;
    --text-color-secondary: #4a5568;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --blur-intensity: 20px;
}

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

html {
    font-family: 'Inter', sans-serif;
    background: var(--background-dark);
    color: var(--text-color-primary);
    transition: background 0.3s, color 0.3s;
}

body {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism Effect */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    transition: background 0.3s, border 0.3s;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width-collapsed);
    height: calc(100vh - 40px);
    position: fixed;
    left: 20px;
    top: 20px;
    display: flex;
    flex-direction: column;
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1000;
}

.sidebar:hover {
    width: var(--sidebar-width-expanded);
}

.sidebar-header {
    padding: 1.75rem 0;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .logo {
    height: 55px;
    transition: transform 0.3s ease;
}

.sidebar:hover .sidebar-header .logo {
    transform: scale(1.1);
}

.sidebar-nav {
    list-style-type: none;
    flex-grow: 1;
    padding: 1rem 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 0.9rem 0;
    margin: 0.6rem 12px;
    text-decoration: none;
    color: var(--text-color-secondary);
    font-weight: 500;
    transition: all 0.25s ease;
    border-radius: 12px;
    white-space: nowrap;
}

.sidebar-nav li a .icon {
    min-width: calc(var(--sidebar-width-collapsed) - 24px);
    text-align: center;
    font-size: 1.3rem;
}

.sidebar-nav li a .nav-text {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar:hover .sidebar-nav li a .nav-text {
    opacity: 1;
    visibility: visible;
}

.sidebar-nav li a:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-color-primary);
}

[data-theme='light'] .sidebar-nav li a:hover {
    background: rgba(0, 0, 0, 0.05);
}


.sidebar-nav li a.active {
    background: var(--primary-glow);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 20px -5px var(--primary-glow);
}

.main-content {
    flex-grow: 1;
    padding: 2.5rem;
    margin-left: calc(var(--sidebar-width-collapsed) + 40px);
    transition: margin-left 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color-secondary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle-btn:hover {
    color: var(--text-color-primary);
    border-color: var(--transaf-orange);
}

.burger-menu {
    display: none;
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-color-primary);
    z-index: 1100;
}

/* KPI CARDS */
.stat-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon.distance { color: #3b82f6; }
.stat-icon.consumption { color: #f97316; }
.stat-icon.drivers { color: #8b5cf6; }
.stat-icon.delivery { color: #10b981; }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-color-secondary);
}

/* MAIN GRID */
.main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-areas: "left right";
    gap: 2.5rem;
}

.grid-left-column { grid-area: left; }
.grid-right-column {
    grid-area: right;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px -10px rgba(0, 0, 0, 0.4);
}

.card-header {
    padding: 1.75rem;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 600;
}

.card-header .icon {
    margin-right: 1rem;
}

.card-content {
    padding: 0 1.75rem 1.75rem;
    flex-grow: 1;
}

/* MAP CARD */
.map-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.map-card .card-content {
    padding: 0;
    flex-grow: 1;
}

/* SAFI-WEB/static/style.css */
#map-container {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border-radius: 0 0 20px 20px;
    background-color: #FFFFFF; /* Changed to white */
}

/* Stiluri pentru iconițele personalizate ale camioanelor pe hartă */
.custom-div-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.truck-icon-on {
    background-color: #28a745; /* Verde pentru motor pornit */
}

.truck-icon-off {
    background-color: #dc3545; /* Roșu pentru motor oprit */
}

/* Popup-ul hărții Leaflet */
.vehicle-popup-content ul li i {
    color: var(--text-color-secondary);
    width: 25px;
    text-align: center;
    margin-right: 8px;
}

/* QUICK ACTIONS */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quick-action-btn {
    width: 100%;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-color-secondary);
    font-size: 1rem;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.quick-action-btn:hover {
    background: var(--transaf-orange);
    color: #fff;
    border-color: var(--transaf-orange);
}

[data-theme='light'] .quick-action-btn {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
}
[data-theme='light'] .quick-action-btn:hover {
    background: var(--transaf-orange);
    color: #fff;
    border-color: var(--transaf-orange);
}

.quick-action-btn i {
    margin-right: 0.75rem;
    width: 20px;
}


/* Responsive Design */
@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: 1fr;
        grid-template-areas: "left" "right";
    }
}

@media (max-width: 900px) {
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .stat-cards-grid {
        grid-template-columns: 1fr 1fr;
    }

    .sidebar {
        transform: translateX(-110%);
    }

    .sidebar-nav li a .nav-text {
        opacity: 1;
        visibility: visible;
    }

    [data-theme='light'] .sidebar {
        transform: translateX(0);
    }

    .burger-menu {
        display: block;
    }
}
/* ============================================= */
/* SECȚIUNEA PENTRU ȘOFERI            */
/* ============================================= */

/* Stiluri pentru tabelul din /soferi */
.soferi-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-color-primary);
}

.soferi-table th, .soferi-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    position: relative; /* Ensure positioning context for dropdown */
    overflow: visible; /* Allow content to overflow */
}

.soferi-table thead {
    background: rgba(0,0,0,0.1);
}

[data-theme='light'] .soferi-table thead {
    background: rgba(0,0,0,0.03);
}

.soferi-table th {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-color-secondary);
}

.soferi-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme='light'] .soferi-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.soferi-table .action-link {
    color: var(--transaf-orange);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.soferi-table .action-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Stiluri pentru dropdown-ul de acțiuni */
.action-dropdown {
    position: relative;
    display: inline-block;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-color-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme='light'] .action-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--glass-bg);
    min-width: 160px;
    box-shadow: var(--glass-shadow);
    z-index: 10;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    overflow: hidden;
}

.dropdown-content a {
    color: var(--text-color-primary);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s ease;
}

.dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.07);
}

[data-theme='light'] .dropdown-content a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.action-dropdown:hover .dropdown-content {
    display: block;
}


/* Stiluri pentru link-ul de "înapoi" */
.back-link {
    color: var(--text-color-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}
.back-link:hover {
    color: var(--text-color-primary);
}
.header .back-link {
    margin-left: auto;
    padding-right: 2rem;
}


/* Stiluri pentru pagina de detaliu a șoferului */
.sofer-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "profil statistici"
        "grafic-eco grafic-consum"
        "istoric istoric";
    gap: 2.5rem;
}

.sofer-card { grid-area: profil; display: flex; align-items: center; gap: 2rem; padding: 2rem; }
.sofer-stats { grid-area: statistici; padding: 2rem; }
.sofer-graph-eco { grid-area: grafic-eco; }
.sofer-graph-consum { grid-area: grafic-consum; }
.sofer-istoric { grid-area: istoric; }

.sofer-avatar {
    font-size: 5rem;
    width: 120px;
    height: 120px;
    min-width: 120px;
    border-radius: 50%;
    background: rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--transaf-orange);
}

.sofer-info h2 {
    font-size: 2rem;
    margin: 0 0 0.5rem;
}
.sofer-info p {
    font-size: 1rem;
    color: var(--text-color-secondary);
    margin: 0.25rem 0;
}

.sofer-stats h3 {
    margin: 0 0 1.5rem;
    font-size: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}
.sofer-stats p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
}
.sofer-stats p .fa-star {
    color: #facc15; /* galben */
}

.placeholder-text {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color-secondary);
    font-style: italic;
    opacity: 0.7;
}

/* Responsive pentru pagina de șoferi */
@media (max-width: 1024px) {
    .sofer-detail-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "profil"
            "statistici"
            "grafic-eco"
            "grafic-consum"
            "istoric";
    }
}
/* Stiluri pentru antetele de tabel sortabile */
.soferi-table .sortable a {
    color: var(--text-color-secondary);
    text-decoration: none;
    margin-left: 0.5rem;
    display: inline-block;
    transition: color 0.2s ease;
}

.soferi-table .sortable a:hover {
    color: var(--transaf-orange);
}

.soferi-table .sortable i {
    font-size: 0.8em;
}
/* Stiluri pentru butoane și acțiuni de pagină */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--transaf-orange);
    color: #fff;
    box-shadow: 0 4px 20px -5px var(--primary-glow);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.secondary-btn {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #e2e8f0;
}

.secondary-btn:hover {
    background-color: #f8fafc;
}

.btn-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid var(--glass-border);
    color: var(--text-color-secondary);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--transaf-orange);
    color: var(--text-color-primary);
}

[data-theme='light'] .btn-glass {
    color: var(--text-color-primary);
}

[data-theme='light'] .btn-glass:hover {
    background: rgba(0, 0, 0, 0.05);
}

.page-actions {
    margin-bottom: 2.5rem;
}

/* Modal Action Buttons */
.modal-actions {
    display: flex;
    gap: 15px; /* Gap between button groups */
    align-items: center;
    margin-top: auto; /* Pushes the actions to the bottom */
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.modal-actions > div {
    display: flex;
    gap: 10px; /* Gap between buttons within a group */
}

.action-divider {
    flex-grow: 1; /* This is the spacer */
}

.default-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-color-secondary);
}
.default-btn:hover {
    background: var(--glass-bg);
    color: var(--text-color-primary);
}

.danger-btn {
    background: rgba(229, 62, 62, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}
.danger-btn:hover {
    background: rgba(229, 62, 62, 0.2);
    color: #f56565; /* lighter red */
}

.action-btn-inno, .action-btn-loctracker, .action-btn-telegram {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color-secondary);
}

.action-btn-inno:hover {
    border-color: #f97316; /* orange */
    color: #f97316;
}
.action-btn-loctracker:hover {
    border-color: #3b82f6; /* blue */
    color: #3b82f6;
}
.action-btn-telegram:hover {
    border-color: #229ED9; /* telegram blue */
    color: #229ED9;
}


/* Stiluri pentru formulare */
.form-container {
    padding: 2.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color-secondary);
}

.form-group input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0,0,0,0.1);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-color-primary);
    font-size: 1rem;
}

[data-theme='light'] .form-group input[type="text"] {
    background: rgba(0,0,0,0.03);
}

.form-actions {
    margin-top: 2rem;
    text-align: right;
}

.readonly-input {
    background-color: rgba(0, 0, 0, 0.2) !important;
    cursor: not-allowed;
}

[data-theme='light'] .readonly-input {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

.soferi-table .action-link.edit-link {
    color: var(--warning-color);
}

/* ============================================= */
/* Stiluri pentru Leaderboard si Restricții      */
/* ============================================= */

/* Lista pentru Leaderboard */
.leaderboard-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.leaderboard-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.leaderboard-list li:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    font-weight: 600;
}

.leaderboard-score {
    font-weight: 700;
    color: var(--success-color);
}

/* Lista pentru Restricții */
.restrictions-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.restrictions-list li {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.restrictions-list li:last-child {
    border-bottom: none;
}

.restriction-country {
    display: flex;
    align-items: center;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.restriction-country .fi {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    border-radius: 3px;
}

.restriction-details {
    display: block;
    color: var(--text-color-secondary);
    font-size: 0.9rem;
    padding-left: 2.1rem; /* Aliniere cu textul țării */
}

.restriction-period {
    display: block;
    color: var(--danger-color);
    font-size: 0.9rem;
    font-weight: 500;
    padding-left: 2.1rem; /* Aliniere cu textul țării */
    margin-top: 0.25rem;
}
/* Stiluri pentru containerul iframe trafficban.com */
.traffic-ban-iframe-container {
    padding: 0;
    height: 400px;
    display: flex;
}

.traffic-ban-iframe-container iframe {
    width: 100%;
    height: 100%;
    border-radius: 0 0 20px 20px;
    border: none;
}
.restriction-detail-list {
    list-style-type: none;
    padding-left: 2.1rem; /* Aliniere cu textul țării */
    margin-top: 0.5rem;
}

.restriction-detail-list li {
    font-size: 0.9rem;
    color: var(--text-color-secondary);
    padding: 0.2rem 0;
    border: none;
}
/* ============================================= */
/* STILURI PENTRU PAGINA DE LOGIN (ÎMBUNĂTĂȚITE)  */
/* ============================================= */

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--background-dark);
}

.login-container {
    max-width: 420px;
    width: 100%;
    padding: 2rem;
}

.login-box {
    padding: 2.5rem 3rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header .logo {
    height: 60px;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color-primary);
}

.login-header p {
    color: var(--text-color-secondary);
    font-size: 1rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form .form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-color-secondary);
    font-size: 0.9rem;
}

/* REGULA CHEIE: Se aplică la ambele câmpuri (text și parolă) */
.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-color-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--transaf-orange);
    box-shadow: 0 0 0 3px rgba(245, 130, 32, 0.2);
}

.login-form .form-actions {
    margin-top: 2rem;
}

.login-form .btn {
    width: 100%;
    padding: 0.9rem;
    font-size: 1rem;
    font-weight: 600;
}

.error-message {
    color: var(--danger-color);
    background-color: rgba(229, 62, 62, 0.1);
    border: 1px solid var(--danger-color);
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* ============================================= */
/* STILURI PENTRU PAGINA DE PLANNER              */
/* ============================================= */

.planner-grid .card {
    overflow: visible; /* This allows the dropdown menu to display outside the card's boundaries */
}
.planner-grid {
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr; /* This keeps the sections stacked in a single column */
    gap: 2.5rem;                /* This controls the space between each section */
}


/* Modify your existing dropdown styles like this */

.action-dropdown {
    position: relative; /* Establishes a positioning context for the dropdown menu. */
    display: inline-block;
}

/* This lifts the active dropdown above other elements */
.action-dropdown:hover {
    z-index: 100;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--glass-bg);
    min-width: 160px;
    box-shadow: var(--glass-shadow);
    z-index: 1; /* Keep this z-index relative to the parent */
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
}

.dropdown-content a {
    color: var(--text-color-primary);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s ease;
}

.dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.07);
}

[data-theme='light'] .dropdown-content a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.action-dropdown:hover .dropdown-content {
    display: block;
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1001; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.8); /* Darker overlay */
    backdrop-filter: blur(10px); /* More blur */
    -webkit-backdrop-filter: blur(10px);
    display: flex; /* Use flexbox for centering */
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally */
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: 30px;
    margin: 20px;
    width: 95%;
    max-width: 1600px; /* Set a reasonable max-width */
    max-height: calc(100vh - 40px); /* Use max-height to allow scrolling */
    position: relative;
    text-align: left;
    color: var(--text-color-primary);
    display: flex;
    flex-direction: column;
}

#view-order-form {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow the form to fill the modal's content area */
    min-height: 0; /* Critical fix for allowing a child element to scroll within a flex container */
}

.modal-content h2 {
    font-size: 2rem; /* Larger title */
    margin-bottom: 1.5rem;
    color: var(--transaf-orange);
    text-align: center; /* Center title */
    flex-shrink: 0; /* Prevent title from shrinking */
}

.modal-content p {
    font-size: 1rem;
    color: var(--text-color-secondary);
    margin-bottom: 1.5rem;
    text-align: center; /* Center paragraph */
}

.modal-content input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(0,0,0,0.1);
    color: var(--text-color-primary);
}

.modal-content input[type="file"]::file-selector-button {
    background-color: var(--transaf-orange);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.modal-content input[type="file"]::file-selector-button:hover {
    background-color: #e0721a;
}

.modal-content .btn {
    width: auto;
    padding: 0.8rem 2rem;
    margin-top: 1rem; /* Add some space above buttons */
}

.close-button {
    color: var(--text-color-secondary);
    position: absolute;
    top: 20px; /* Adjusted for padding */
    right: 30px; /* Adjusted for padding */
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-button:hover,
.close-button:focus {
    color: var(--transaf-orange);
    text-decoration: none;
    cursor: pointer;
}

/* New styles for the extracted data layout */
#extracted-data-section {
    flex-grow: 1; /* Allow this section to take available space */
    display: flex; /* Use flexbox for overall layout */
    flex-direction: column; /* Stack sections vertically */
    gap: 20px;
    padding-top: 20px; /* Space below title */
    overflow-y: auto; /* Enable scrolling for content if needed */
}

#extracted-data-section h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--transaf-orange);
}

#extracted-data-section h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-color-primary);
}

#extracted-data-section .form-group {
    margin-bottom: 1rem;
    text-align: left;
}

#extracted-data-section .form-group label {
    font-size: 0.9rem;
    color: var(--text-color-secondary);
    margin-bottom: 0.3rem;
}

/* General style for form inputs */
.editable-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-color-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none; /* Removes default Safari/iOS styling for select */
    -moz-appearance: none;
    appearance: none;
}

.editable-input:focus {
    outline: none;
    border-color: var(--transaf-orange);
    box-shadow: 0 0 0 3px rgba(245, 130, 32, 0.2);
}

/* Add an arrow for select elements */
.form-group select.editable-input {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23efefef' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

/* Top fields layout */
.top-order-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    flex-shrink: 0; /* Prevent this section from shrinking */
}

/* Main content grid for Inc/Desc/Vama */
.main-order-content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Flexible columns */
    gap: 20px;
    flex-grow: 1; /* Allow this grid to take available vertical space */
    overflow-y: auto; /* This is where the scrolling will happen */
    padding: 10px;
}

.order-section {
    border: 1px solid var(--glass-border); /* The "chenar" */
    border-radius: 12px;
    padding: 20px;
    background: rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 15px; /* Space between form groups within a section */
}

.address-group {
    border: 1px solid rgba(255, 255, 255, 0.15); /* Border for each address block */
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    background: rgba(0,0,0,0.05);
}

.address-group h5 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--transaf-orange);
}

/* Additional details section at the bottom */
.additional-details-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    flex-shrink: 0; /* Prevent this section from shrinking */
}

.additional-details-section .form-group {
    display: inline-block; /* Arrange side-by-side */
    width: 48%; /* Adjust width */
    margin: 0 1%; /* Space between them */
    vertical-align: top; /* Align top for different heights */
}

#save-order-btn {
    width: fit-content; /* Adjust button width */
    margin: 20px auto 0 auto; /* Center the button */
    display: block; /* Ensure margin auto works */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: 1fr; /* Stack columns on smaller screens */
        grid-template-areas: "left" "right";
    }
}

@media (max-width: 900px) {
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .stat-cards-grid {
        grid-template-columns: 1fr 1fr;
    }

    .sidebar {
        transform: translateX(-110%);
    }

    .sidebar-nav li a .nav-text {
        opacity: 1;
        visibility: visible;
    }

    [data-theme='light'] .sidebar {
        transform: translateX(0);
    }

    .burger-menu {
        display: block;
    }

    .top-order-fields {
        grid-template-columns: 1fr; /* Stack top fields on small screens */
    }

    .main-order-content-grid {
        grid-template-columns: 1fr; /* Stack main sections on small screens */
    }

    .additional-details-section .form-group {
        width: 100%; /* Stack km fields on small screens */
        margin: 0 0 1rem 0;
    }
}

/* NEW STYLES FOR ORDER MODAL */

/* This creates a distinct box for each loading/unloading point */
.address-entry {
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    background: rgba(0,0,0,0.08);
}

.address-entry h5 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--transaf-orange);
}

/* This fixes the overflow issue by stacking the input fields */
.address-group-view {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Adds space between the input fields */
}

/* Loader Styles */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.loader {
    border: 6px solid var(--glass-border);
    border-top: 6px solid var(--transaf-orange);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.action-buttons {
    display: flex;
    gap: 0.5rem; /* 8px gap between buttons */
}

/* ============================================= */
/* STILURI PENTRU PAGINA DE ECO DRIVING          */
/* ============================================= */

.eco-classification-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

.eco-classification-grid .card {
    transition: all 0.3s ease;
}

.eco-classification-grid .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.eco-classification-grid .card-header {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    border-bottom: none;
}

.eco-classification-grid .card-header.excellent { background-color: #2f855a; } /* Verde închis */
.eco-classification-grid .card-header.average { background-color: #d69e2e; } /* Auriu/Muștar */
.eco-classification-grid .card-header.poor { background-color: #c53030; } /* Roșu închis */

.driver-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.driver-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: 1rem;
}

.driver-list li:last-child {
    border-bottom: none;
}

.driver-name {
    font-weight: 500;
}

.driver-score {
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    color: #fff;
}

.excellent .driver-score { background-color: #38a169; } /* Verde */
.average .driver-score { background-color: #dd6b20; } /* Portocaliu */
.poor .driver-score { background-color: #e53e3e; } /* Roșu */

/* ============================================= */
/* STILURI NOI PENTRU BUTOANELE DIN MODAL        */
/* ============================================= */

.order-section h4 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.75rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.action-icon-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.action-icon-btn:hover {
    color: var(--text-color-primary);
    border-color: var(--transaf-orange);
}

.action-icon-btn.delete-station-btn {
    background: rgba(229, 62, 62, 0.1);
    border-color: var(--danger-color);
    color: var(--danger-color);
    width: auto; /* Allow width to be flexible */
    padding: 0 0.75rem; /* Add some padding */
}

.action-icon-btn.delete-station-btn:hover {
    background: rgba(229, 62, 62, 0.2);
    color: #f56565;
}

.address-group-view {
    display: grid;
    grid-template-columns: 1fr auto; /* Inputs take full width, button is auto */
    gap: 10px;
    align-items: center;
}

.address-group-view .editable-input {
    grid-column: 1 / -1; /* Make inputs span all columns */
}

/* The last element in the group, which is the button, will be in the second column */
.address-group-view .delete-station-btn {
    grid-column: 2 / 3;
    margin-top: auto; /* Align to the bottom of the grid cell if needed */
    align-self: end; /* Align to the end of the grid area */
    margin-bottom: 10px; /* Align with input field spacing */
}

.vama-options {
    display: flex;
    gap: 10px;
    padding-left: 10px;
}

/* --- STILURI NOI PENTRU SECȚIUNEA DE DETALII SUPLIMENTARE --- */

.details-toggle-container {
    margin-top: 20px;
    text-align: center;
}

.details-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-color-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.details-toggle-btn:hover {
    color: var(--transaf-orange);
    border-color: var(--transaf-orange);
    background: rgba(245, 130, 32, 0.1);
}

[data-theme='light'] .details-toggle-btn {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme='light'] .details-toggle-btn:hover {
    border-color: var(--transaf-orange);
    background: rgba(245, 130, 32, 0.1);
}

.details-toggle-btn .fa-chevron-down {
    transition: transform 0.3s ease;
}

.details-toggle-btn.open .fa-chevron-down {
    transform: rotate(180deg);
}

#additional-details-content {
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out, opacity 0.4s ease-out;
    max-height: 0;
    padding: 0 20px;
    opacity: 0;
    border-top: none;
    margin-top: 0;
    display: flex; /* Use flexbox for layout */
    flex-wrap: wrap; /* Allow items to wrap */
    gap: 20px; /* Space between items */
    justify-content: center; /* Center the items */
}

#additional-details-content.open {
    max-height: 500px; /* Adjust as needed */
    opacity: 1;
    padding: 20px;
    border-top: 1px solid var(--glass-border);
    margin-top: 15px;
}

#additional-details-content .form-group {
    flex: 1 1 300px; /* Flex properties for responsive layout */
    min-width: 250px;
}

/* --- MAP MODAL --- */
.map-search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

#map-search-input {
    flex-grow: 1;
    padding: 0.8rem 1rem;
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-color-primary);
    font-size: 1rem;
}

#map-container {
    flex-grow: 1;
    border-radius: 12px;
    overflow: hidden;
}

.coords-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.coords-container .editable-input {
    flex-grow: 1;
}

.coords-container .open-map-btn {
    flex-shrink: 0;
    padding: 8px 12px;
}

