/**
 * Frontend styles for Tobalt Waste plugin.
 *
 * @package Tobalt_Waste
 * @author Tobalt — https://tobalt.lt
 */

/* Container */
.tobalt-waste-container {
    --tobalt-primary: #059669;
    --tobalt-primary-dark: #047857;
    --tobalt-primary-light: #d1fae5;
    --tobalt-gray-300: #cbd5e1;
    --tobalt-gray-600: #475569;
    --tobalt-gray-700: #334155;
    --tobalt-font-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;

    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: var(--tobalt-font-sans);
}

/* Buttons */
.tobalt-waste-container .tobalt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--tobalt-font-sans);
    font-size: 13px !important;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    border: 1.5px solid var(--tobalt-gray-300) !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    background: #ffffff !important;
    color: var(--tobalt-gray-700) !important;
    min-height: 42px;
}

.tobalt-waste-container .tobalt-btn:hover {
    background: var(--tobalt-primary-light) !important;
    border-color: var(--tobalt-primary) !important;
    color: var(--tobalt-primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15);
}

.tobalt-waste-container .tobalt-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.3);
}

.tobalt-waste-container .tobalt-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.tobalt-waste-container .tobalt-btn svg,
.tobalt-waste-container .tobalt-btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.tobalt-waste-container .tobalt-btn-primary {
    background: var(--tobalt-primary) !important;
    color: #ffffff !important;
    border-color: var(--tobalt-primary) !important;
}

.tobalt-waste-container .tobalt-btn-primary:hover {
    background: var(--tobalt-primary-dark) !important;
    border-color: var(--tobalt-primary-dark) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.tobalt-waste-container .tobalt-btn-primary:active {
    transform: translateY(0);
}

[x-cloak] {
    display: none !important;
}

/* Title */
.tobalt-waste-title {
    text-align: center;
    font-size: 28px;
    color: #1d2327;
    margin-bottom: 30px;
}

/* Search Section */
.tobalt-waste-search {
    margin-bottom: 30px;
}

.tobalt-waste-search-form {
    max-width: 500px;
    margin: 0 auto;
}

.tobalt-autocomplete-wrapper {
    position: relative;
}

.tobalt-location-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #dcdcde;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tobalt-location-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.tobalt-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
}

.tobalt-autocomplete-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.tobalt-autocomplete-item:hover {
    background: #f0f6fc;
}

/* Selected Location */
.tobalt-selected-location {
    text-align: center;
    margin-top: 10px;
}

.tobalt-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-family: var(--tobalt-font-sans);
    font-size: 12px !important;
    font-weight: 500;
    line-height: 1.3;
    border: 1px solid var(--tobalt-primary) !important;
    border-radius: 999px !important;
    background: var(--tobalt-primary-light) !important;
    color: var(--tobalt-primary-dark) !important;
}

.tobalt-location-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--tobalt-primary-dark) !important;
    border: none !important;
    border-radius: 50% !important;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    color: #fff !important;
    padding: 0;
    transition: background 200ms ease;
}

.tobalt-location-clear:hover {
    background: var(--tobalt-primary) !important;
}

/* Loading */
.tobalt-loading {
    text-align: center;
    padding: 40px;
    color: #646970;
}

.tobalt-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #dcdcde;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: tobalt-spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* Calendar Navigation */
.tobalt-calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 25px;
}


.tobalt-current-year {
    font-size: 24px;
    color: #1d2327;
    margin: 0;
}

/* Legend */
.tobalt-waste-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.tobalt-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.tobalt-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Quarter Navigation */
.tobalt-quarter-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.tobalt-quarter-label {
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
    min-width: 180px;
    text-align: center;
}

/* Calendar Grid */
.tobalt-calendar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.tobalt-month-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 15px;
}

.tobalt-month-name {
    text-align: center;
    font-size: 16px;
    color: #1d2327;
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f1;
}

.tobalt-month-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.tobalt-day-header {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #646970;
    padding: 5px;
    text-transform: uppercase;
}

.tobalt-day-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    min-height: 32px;
}

.tobalt-day-cell:hover:not(.tobalt-day-empty) {
    background: #f0f6fc;
}

.tobalt-day-empty {
    cursor: default;
}

.tobalt-day-number {
    font-weight: 500;
}

.tobalt-day-dots {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}

.tobalt-day-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.tobalt-day-has-collection {
    background: #f0f6fc;
}

.tobalt-day-today {
    border: 2px solid #2271b1;
}

/* Modal */
.tobalt-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.tobalt-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    max-width: 400px;
    width: 100%;
    position: relative;
}

.tobalt-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #646970;
    line-height: 1;
}

.tobalt-modal-close:hover {
    color: #1d2327;
}

.tobalt-modal-content h3 {
    margin: 0 0 20px;
    padding-right: 30px;
    font-size: 16px;
}

.tobalt-waste-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tobalt-waste-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f1;
}

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

.tobalt-waste-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* No Results */
.tobalt-no-results {
    text-align: center;
    padding: 40px;
    color: #646970;
}

/* Print Section */
.tobalt-print-section {
    text-align: center;
    margin-top: 30px;
}


/* Responsive */
@media (max-width: 768px) {
    .tobalt-waste-container {
        padding: 15px;
    }

    .tobalt-waste-title {
        font-size: 22px;
    }

    .tobalt-location-input {
        padding: 12px 15px;
        font-size: 15px;
    }

    .tobalt-calendar-grid {
        grid-template-columns: 1fr;
    }

    .tobalt-waste-legend {
        gap: 10px;
    }

    .tobalt-legend-item {
        font-size: 12px;
    }

    .tobalt-calendar-nav {
        gap: 15px;
    }

    .tobalt-current-year {
        font-size: 20px;
    }

    .tobalt-quarter-nav {
        gap: 10px;
    }

    .tobalt-quarter-label {
        font-size: 15px;
        min-width: 140px;
    }
}

/* Map Section */
.tobalt-map-section {
    margin: 30px 0;
}

.tobalt-map-header {
    text-align: center;
    margin-bottom: 15px;
}


.tobalt-map-container {
    border: 1px solid #dcdcde;
    border-radius: 8px;
    overflow: hidden;
}

.tobalt-map {
    height: 400px;
    width: 100%;
    background: #f0f0f1;
}

.tobalt-map-marker {
    background: transparent !important;
    border: none !important;
}

.tobalt-map-popup {
    font-size: 14px;
    line-height: 1.4;
}

.tobalt-map-popup strong {
    color: #1d2327;
}

.tobalt-map-popup small {
    color: #646970;
}

/* Leaflet overrides */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 12px 15px;
}

/* Print — handled via window.open() in printCalendar() */
