/* Amity Drinks - Závozové trasy */
/* Visual Identity: Royalty Purple, Fresh and Gold, Herbal Green, Grape Time, Zen Beige */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Amity Drinks official brand colors */
    --primary-color: #222F89;       /* Royalty Purple */
    --primary-light: #3a48a8;
    --primary-dark: #181f6a;
    --gold: #C8A43B;                /* Fresh and Gold */
    --gold-light: #d8b85a;
    --green: #46BE82;               /* Herbal Green */
    --green-light: #62d099;
    --grape: #7F86E3;               /* Grape Time */
    --grape-light: #9da3eb;
    --zen-beige: #F8F6E3;           /* Zen Beige */
    --accent-red: #E05260;
    --black: #000000;
    --white: #FFFFFF;

    /* UI colors derived from brand */
    --background-light: #F8F6E3;    /* Zen Beige background */
    --background-sidebar: #FFFFFF;
    --text-dark: #18205a;
    --text-medium: #4a4a7a;
    --text-light: #8a8aaa;
    --border-color: #e6e4d0;
    --border-light: #f0eed8;

    --shadow-sm: 0 1px 3px rgba(34, 47, 137, 0.07);
    --shadow: 0 2px 12px rgba(34, 47, 137, 0.10);
    --shadow-hover: 0 4px 24px rgba(34, 47, 137, 0.14);
    --shadow-lg: 0 8px 32px rgba(34, 47, 137, 0.18);

    /* Day colors */
    --monday-color: #E74C3C;
    --tuesday-color: #E67E22;
    --wednesday-color: #C8A43B;
    --thursday-color: #46BE82;
    --friday-color: #7F86E3;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
}

html, body {
    height: 100%;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--background-light);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 380px;
    background-color: var(--background-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 60%, #2e3fa0 100%);
    color: var(--white);
    padding: 24px 24px 20px;
    position: relative;
}

.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gold) 0%, var(--gold-light) 50%, var(--gold) 100%);
}

.sidebar-logo {
    display: block;
    height: 36px;
    width: auto;
    margin-bottom: 12px;
}

.sidebar-header h1 {
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.75;
    color: var(--gold-light);
}

/* Week info */
.week-info {
    text-align: center;
    padding: 10px 20px;
    background-color: var(--zen-beige);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
    color: var(--text-medium);
    font-weight: 400;
}

.week-info strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background-color: var(--white);
    border-bottom: 2px solid var(--border-color);
}

.action-btn {
    flex: 1;
    padding: 9px 14px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.action-btn.show-all {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.action-btn.show-all:hover {
    background-color: var(--primary-light);
    box-shadow: var(--shadow);
}

.action-btn.hide-all {
    background-color: var(--zen-beige);
    color: var(--text-medium);
    border: 1px solid var(--border-color);
}

.action-btn.hide-all:hover {
    background-color: var(--border-light);
    border-color: #c8c6a8;
}

/* Distributors list */
.distributors-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

.distributors-list h2 {
    font-size: 0.72rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 6px;
    padding-left: 4px;
    font-weight: 600;
}

.help-text {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-bottom: 14px;
    padding-left: 4px;
    line-height: 1.5;
}

/* Distributor card */
.distributor-card {
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
    border: 1.5px solid var(--border-color);
    animation: fadeIn 0.3s ease;
}

.distributor-card:hover {
    border-color: #c8c8d8;
    box-shadow: var(--shadow-sm);
}

.distributor-card.active {
    border-color: var(--primary-color);
    background-color: rgba(34, 47, 137, 0.04);
    box-shadow: var(--shadow);
}

.distributor-header {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* Checkbox */
.distributor-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid #c8c8d8;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
    background-color: var(--white);
}

.distributor-checkbox:hover {
    border-color: var(--primary-color);
}

.distributor-checkbox.checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.distributor-checkbox .checkmark {
    color: var(--white);
    font-size: 13px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.distributor-checkbox.checked .checkmark {
    opacity: 1;
}

.distributor-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.distributor-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-dark);
}

.distributor-routes {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

/* Day legend */
.day-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.day-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-light);
    padding: 4px 10px;
    border-radius: 20px;
    background-color: var(--background-light);
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    font-weight: 500;
}

.day-item:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-sm);
}

.day-item.active {
    font-weight: 600;
    color: var(--white);
    border-color: transparent;
}

.day-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.day-item.monday .day-dot { background-color: var(--monday-color); }
.day-item.tuesday .day-dot { background-color: var(--tuesday-color); }
.day-item.wednesday .day-dot { background-color: var(--wednesday-color); }
.day-item.thursday .day-dot { background-color: var(--thursday-color); }
.day-item.friday .day-dot { background-color: var(--friday-color); }

.day-item.monday.active { background-color: var(--monday-color); }
.day-item.tuesday.active { background-color: var(--tuesday-color); }
.day-item.wednesday.active { background-color: var(--wednesday-color); }
.day-item.thursday.active { background-color: var(--thursday-color); }
.day-item.friday.active { background-color: var(--friday-color); }

/* Route list */
.route-list {
    max-height: 250px;
    overflow-y: auto;
}

.route-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    background-color: var(--background-light);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.route-item:hover {
    background-color: #eaebf2;
}

.route-item.active {
    background-color: #e0e2f0;
    border-left-width: 4px;
    box-shadow: inset 0 0 0 1px rgba(37, 47, 137, 0.15);
}

.route-item.monday { border-left-color: var(--monday-color); }
.route-item.tuesday { border-left-color: var(--tuesday-color); }
.route-item.wednesday { border-left-color: var(--wednesday-color); }
.route-item.thursday { border-left-color: var(--thursday-color); }
.route-item.friday { border-left-color: var(--friday-color); }

.route-name {
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--text-dark);
}

.route-summary {
    font-size: 0.78rem;
    color: var(--text-medium);
    font-weight: 500;
    margin-bottom: 3px;
}

.route-cities {
    font-size: 0.72rem;
    color: var(--text-light);
    line-height: 1.4;
}

.route-stats {
    display: flex;
    gap: 12px;
    margin-top: 5px;
    font-size: 0.68rem;
    color: var(--primary-color);
    font-weight: 500;
}

.route-note {
    font-size: 0.7rem;
    color: var(--accent-red);
    margin-bottom: 3px;
    font-weight: 500;
}

.popup-note {
    background-color: rgba(200, 164, 59, 0.1);
    color: #7a5a0a;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    margin: 8px 0;
    font-size: 0.78rem;
    border-left: 3px solid var(--gold);
}

.popup-distributor-small {
    color: var(--text-light);
    font-size: 0.82rem;
    margin-bottom: 4px;
}

/* ===== MAP ===== */
.map-container {
    flex: 1;
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
}

/* Map legend */
.map-legend {
    position: absolute;
    bottom: 30px;
    left: 15px;
    background-color: var(--white);
    padding: 14px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
}

.map-legend h4 {
    font-size: 0.78rem;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.78rem;
    color: var(--text-medium);
}

.legend-color {
    width: 20px;
    height: 3px;
    border-radius: 2px;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow);
    font-size: 1.1rem;
    transition: background-color 0.15s ease;
}

.mobile-menu-btn:hover {
    background-color: var(--primary-light);
}

/* Leaflet marker styles */
.city-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2.5px solid var(--white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    font-weight: 600;
    color: var(--white);
    font-size: 11px;
    font-family: 'Inter', sans-serif;
}

.leaflet-interactive {
    cursor: pointer;
}

.leaflet-overlay-pane path {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Depot marker */
.depot-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    border-radius: 8px;
    border: 2.5px solid var(--white);
    box-shadow: 0 2px 10px rgba(37, 47, 137, 0.35);
    font-size: 18px;
}

.popup-depot-info {
    background-color: var(--background-light);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    margin: 8px 0;
    font-size: 0.82rem;
    border-left: 3px solid var(--primary-color);
}

.popup-stop-number {
    background-color: var(--primary-color);
    color: white;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Popup styles */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.leaflet-popup-content {
    margin: 14px;
    font-family: 'Inter', sans-serif;
}

.popup-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.popup-day {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    color: var(--white);
    margin-bottom: 8px;
    font-weight: 500;
}

.popup-cities {
    font-size: 0.82rem;
    color: var(--text-light);
    line-height: 1.6;
}

.popup-route {
    font-size: 0.82rem;
    margin-bottom: 8px;
    color: var(--text-medium);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 380px;
        height: 100%;
        transition: left 0.3s ease;
        z-index: 1002;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(34, 47, 137, 0.35);
        z-index: 1001;
        backdrop-filter: blur(3px);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .mobile-menu-btn {
        display: block;
    }

    .map-container {
        height: 100vh;
    }

    .map-legend {
        bottom: auto;
        top: 70px;
        left: 15px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Scrollbar */
.distributors-list::-webkit-scrollbar,
.route-list::-webkit-scrollbar {
    width: 5px;
}

.distributors-list::-webkit-scrollbar-track,
.route-list::-webkit-scrollbar-track {
    background: transparent;
}

.distributors-list::-webkit-scrollbar-thumb,
.route-list::-webkit-scrollbar-thumb {
    background: var(--gold-light);
    border-radius: 3px;
    opacity: 0.6;
}

.distributors-list::-webkit-scrollbar-thumb:hover,
.route-list::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

/* PWA install hint */
.install-hint {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 10px 14px;
    font-size: 0.78rem;
    text-align: center;
    cursor: pointer;
    border-bottom: 2px solid var(--gold);
}

.install-hint:hover {
    opacity: 0.95;
}

.install-hint .close-hint {
    float: right;
    cursor: pointer;
    opacity: 0.7;
}

.install-hint .close-hint:hover {
    opacity: 1;
}
