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

/* Container */
.tobalt-waste-container {
    --tobalt-primary: #047857;
    --tobalt-primary-dark: #065f46;
    --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-day-cell:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
    z-index: 1;
}

.tobalt-autocomplete-item:focus-visible,
.tobalt-autocomplete-item-active {
    background: #f0f6fc;
    outline: none;
}

.tobalt-modal-close:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.tobalt-location-clear:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.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 #94a3b8;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tobalt-location-input::placeholder {
    color: #64748b;
    opacity: 1;
}

.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 5px 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;
}

ul.tobalt-waste-legend {
    list-style: none;
}

.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;
    }
}

/* v1.7.5 — Mobile UX audit. Tighter breakpoint for phones <=480px. */
@media (max-width: 480px) {
    .tobalt-waste-container {
        padding: 10px;
    }

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

    /* Year nav: prevent "2026 m." center label from wrapping next to fixed-width arrow buttons. */
    .tobalt-calendar-nav {
        gap: 8px;
    }

    .tobalt-calendar-nav .tobalt-btn {
        padding: 8px 10px !important;
        font-size: 13px !important;
        flex-shrink: 0;
    }

    .tobalt-current-year {
        font-size: 17px;
        flex: 1;
        text-align: center;
        white-space: nowrap;
    }

    /* Quarter nav: tighter on phones. */
    .tobalt-quarter-nav {
        gap: 6px;
    }

    .tobalt-quarter-nav .tobalt-btn {
        padding: 6px 10px !important;
        font-size: 13px !important;
        flex-shrink: 0;
        min-width: auto;
    }

    .tobalt-quarter-label {
        font-size: 14px;
        min-width: 0;
        flex: 1;
    }

    /* Legend: 2-column grid for orderly compact layout (was chaotic flex-wrap). */
    .tobalt-waste-legend {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px 12px;
        padding: 12px;
        justify-content: stretch;
    }

    .tobalt-legend-item {
        font-size: 11px;
        justify-content: flex-start;
    }

    /* Day cells: bump min-height to 42px (close to WCAG 2.5.5 target),
       drop aspect-ratio so cells can grow taller than wide. */
    .tobalt-day-cell {
        aspect-ratio: auto;
        min-height: 42px;
        font-size: 14px;
    }

    .tobalt-month-card {
        padding: 10px;
    }

    .tobalt-month-name {
        font-size: 15px;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }

    .tobalt-month-days {
        gap: 3px;
    }

    .tobalt-day-header {
        font-size: 10px;
        padding: 4px 0;
    }

    /* Modal: fit phone screen + force theme-button overrides on close. */
    .tobalt-modal {
        padding: 10px;
    }

    .tobalt-modal-content {
        padding: 20px 16px;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tobalt-modal-close {
        width: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        border: none !important;
        background: transparent !important;
        font-size: 22px !important;
        line-height: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        top: 10px !important;
        right: 10px !important;
    }

    .tobalt-modal-content h3 {
        padding-right: 36px;
        font-size: 15px;
    }
}

/* 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() */

/* ============================================================
 * v1.7.2 — Email subscription form (compact, theme-isolated)
 *
 * Goal: panel must look identical across Astra / Hello / GeneratePress /
 * Elementor-styled themes. Heavy use of explicit resets (font, line-height,
 * color, text-transform, letter-spacing, box-shadow, border-radius) on
 * every interactive element so theme cascade can't bleed in. Also uses
 * `unset` on submit-button properties that themes commonly override via
 * .button / button { ... }.
 *
 * Sizing: ~30% smaller than v1.7.0. 8px gaps, 6/10px paddings, 13px text.
 * ============================================================ */
.tobalt-waste-container .tobalt-subscribe-section {
    margin: 12px auto 20px;
    max-width: 420px;
    padding: 10px 12px;
    border: 1px solid var(--tobalt-gray-300);
    border-radius: 6px;
    background: #ffffff;
    box-shadow: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: var(--tobalt-gray-700);
    text-align: left;
}

/* Reset inheritance for every descendant (text-transform/letter-spacing/etc. that themes inject) */
.tobalt-waste-container .tobalt-subscribe-section,
.tobalt-waste-container .tobalt-subscribe-section * {
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
    text-shadow: none;
    font-style: normal;
}

.tobalt-waste-container .tobalt-subscribe-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 2px;
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: var(--tobalt-primary-dark);
    font: 600 13px/1.3 inherit;
    cursor: pointer;
    min-height: 0;
    width: auto;
}

.tobalt-waste-container .tobalt-subscribe-toggle:hover {
    color: var(--tobalt-primary);
    background: transparent;
}

.tobalt-waste-container .tobalt-subscribe-toggle:focus-visible {
    outline: 2px solid var(--tobalt-primary);
    outline-offset: 2px;
}

.tobalt-waste-container .tobalt-subscribe-toggle svg {
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
}

.tobalt-waste-container .tobalt-subscribe-form {
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tobalt-waste-container .tobalt-subscribe-intro {
    margin: 0;
    color: var(--tobalt-gray-600);
    font: 400 12px/1.45 inherit;
}

.tobalt-waste-container .tobalt-subscribe-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
}

.tobalt-waste-container .tobalt-subscribe-field label {
    margin: 0;
    padding: 0;
    font: 600 12px/1.3 inherit;
    color: var(--tobalt-gray-700);
    text-transform: none;
    letter-spacing: normal;
}

.tobalt-waste-container .tobalt-subscribe-field .tobalt-input {
    width: 100%;
    margin: 0;
    padding: 7px 10px;
    border: 1px solid var(--tobalt-gray-300);
    border-radius: 4px;
    background: #ffffff;
    color: var(--tobalt-gray-700);
    font: 400 13px/1.3 inherit;
    box-shadow: none;
    min-height: 0;
}

.tobalt-waste-container .tobalt-subscribe-field .tobalt-input:focus {
    outline: none;
    border-color: var(--tobalt-primary);
    box-shadow: 0 0 0 2px var(--tobalt-primary-light);
}

.tobalt-waste-container .tobalt-lead-time-presets {
    margin: 0;
    padding: 0;
    border: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tobalt-waste-container .tobalt-lead-time-presets legend {
    display: block;
    width: 100%;
    margin: 0 0 4px;
    padding: 0;
    font: 600 12px/1.3 inherit;
    color: var(--tobalt-gray-700);
    float: none;
}

.tobalt-waste-container .tobalt-lead-time-option {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 4px 9px;
    border: 1px solid var(--tobalt-gray-300);
    border-radius: 999px;
    background: #ffffff;
    color: var(--tobalt-gray-700);
    font: 400 12px/1.3 inherit;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.tobalt-waste-container .tobalt-lead-time-option:hover {
    border-color: var(--tobalt-primary);
}

.tobalt-waste-container .tobalt-lead-time-option input[type="radio"] {
    width: 12px;
    height: 12px;
    margin: 0;
    accent-color: var(--tobalt-primary);
}

.tobalt-waste-container .tobalt-lead-time-option:has(input:checked) {
    background: var(--tobalt-primary-light);
    border-color: var(--tobalt-primary);
    color: var(--tobalt-primary-dark);
    font-weight: 600;
}

.tobalt-waste-container .tobalt-privacy-consent {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    font: 400 11px/1.4 inherit;
    color: var(--tobalt-gray-600);
}

.tobalt-waste-container .tobalt-privacy-consent input[type="checkbox"] {
    width: 13px;
    height: 13px;
    margin: 2px 0 0;
    accent-color: var(--tobalt-primary);
    flex: 0 0 13px;
}

.tobalt-waste-container .tobalt-privacy-consent a {
    color: var(--tobalt-primary-dark);
    text-decoration: underline;
}

/* Submit: nuke .tobalt-btn theme overrides via explicit resets */
.tobalt-waste-container .tobalt-subscribe-submit {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 7px 14px !important;
    background: var(--tobalt-primary) !important;
    border: 1px solid var(--tobalt-primary) !important;
    border-radius: 4px !important;
    color: #ffffff !important;
    font: 600 13px/1.2 inherit !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    box-shadow: none !important;
    text-shadow: none !important;
    cursor: pointer;
    min-height: 0 !important;
    width: auto !important;
    transform: none !important;
}

.tobalt-waste-container .tobalt-subscribe-submit:hover:not(:disabled) {
    background: var(--tobalt-primary-dark) !important;
    border-color: var(--tobalt-primary-dark) !important;
    color: #ffffff !important;
    transform: none !important;
    box-shadow: none !important;
}

.tobalt-waste-container .tobalt-subscribe-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tobalt-waste-container .tobalt-subscribe-error {
    margin: 0;
    padding: 6px 9px;
    background: #fef2f2;
    border-left: 3px solid #dc2626;
    border-radius: 3px;
    color: #7f1d1d;
    font: 400 12px/1.4 inherit;
}

.tobalt-waste-container .tobalt-subscribe-success {
    margin: 0;
    padding: 6px 9px;
    background: var(--tobalt-primary-light);
    border-left: 3px solid var(--tobalt-primary);
    border-radius: 3px;
    color: var(--tobalt-primary-dark);
    font: 400 12px/1.4 inherit;
}

/* Confirm/unsubscribe page result box (used by both shortcodes). */
.tobalt-subscribe-result {
    max-width: 640px;
    margin: 32px auto;
    padding: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    font-family: var(--tobalt-font-sans, system-ui, sans-serif);
}

.tobalt-subscribe-result h2 {
    margin: 0 0 12px 0;
    font-size: 20px;
    color: #0f172a;
}

.tobalt-subscribe-result p {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: #334155;
}

.tobalt-subscribe-result form {
    margin-top: 16px;
}

.tobalt-subscribe-result .tobalt-btn-primary {
    padding: 10px 20px;
    background: #047857;
    border: 1px solid #047857;
    border-radius: 6px;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
}

.tobalt-subscribe-result .tobalt-btn-primary:hover {
    background: #065f46;
    border-color: #065f46;
}
