/**
 * CC Store Availability - Styles
 *
 * @author Carlos Casado
 * @copyright 2026 Carlos Casado
 */

/* ── Trigger button ─────────────────────────────── */

.cc-sa-wrapper {
    margin-top: 12px;
}

#cc-sa-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    color: #333333;
    border: 2px solid #333333;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    width: 100%;
    justify-content: center;
}

#cc-sa-open-btn:hover {
    background: #333333;
    color: #ffffff;
}

#cc-sa-open-btn:hover .cc-sa-btn-icon path {
    fill: #ffffff;
}

.cc-sa-btn-icon {
    flex-shrink: 0;
}

/* ── Modal overlay ──────────────────────────────── */

#cc-sa-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

/* ── Modal dialog ───────────────────────────────── */

.cc-sa-modal {
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: ccSaSlideIn 0.25s ease-out;
}

@keyframes ccSaSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Modal header ───────────────────────────────── */

.cc-sa-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e5e5e5;
}

.cc-sa-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

#cc-sa-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: background-color 0.15s;
}

#cc-sa-close-btn:hover {
    background-color: #f0f0f0;
}

/* ── Store list container ───────────────────────── */

.cc-sa-store-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 200px;
    max-height: 50vh;
}

/* ── States: loading, error, no results ─────────── */

#cc-sa-loading,
#cc-sa-error,
#cc-sa-no-results {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    color: #999999;
    min-height: 200px;
}

.cc-sa-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e5e5;
    border-top-color: #333333;
    border-radius: 50%;
    animation: ccSaSpin 0.7s linear infinite;
    margin-bottom: 12px;
}

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

/* ── Store items ────────────────────────────────── */

#cc-sa-stores {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cc-sa-store-item {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s;
}

.cc-sa-store-item:last-child {
    border-bottom: none;
}

.cc-sa-store-item:hover {
    background-color: #fafafa;
}

.cc-sa-store-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.cc-sa-store-name {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

/* ── Availability dots ──────────────────────────── */

.cc-sa-dot,
.cc-sa-status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cc-sa-dot-green {
    background-color: #4caf50;
}

.cc-sa-dot-red {
    background-color: #e53935;
}

.cc-sa-dot-orange {
    background-color: #ff9800;
}

/* ── Address, phone, status ─────────────────────── */

.cc-sa-store-address,
.cc-sa-store-phone {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666666;
    margin: 4px 0 4px 20px;
    text-decoration: none;
}

a.cc-sa-store-address:hover {
    color: #333333;
    text-decoration: underline;
}

a.cc-sa-store-phone:hover {
    color: #333333;
    text-decoration: underline;
}

.cc-sa-pin-icon,
.cc-sa-phone-icon {
    flex-shrink: 0;
}

.cc-sa-store-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-left: 20px;
}

.cc-sa-status-text {
    font-size: 13px;
    font-weight: 500;
}

.cc-sa-store-available .cc-sa-status-text {
    color: #2e7d32;
}

.cc-sa-store-unavailable .cc-sa-status-text {
    color: #c62828;
}

.cc-sa-status-ask {
    color: #e65100;
    font-style: italic;
}

.cc-sa-store-name-link {
    color: inherit;
    text-decoration: none;
}

.cc-sa-store-name-link:hover {
    text-decoration: underline;
}

/* ── Collapsible hours ──────────────────────────── */

.cc-sa-hours-wrap {
    margin-top: 8px;
    padding-left: 20px;
}

.cc-sa-hours-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: #666666;
    padding: 4px 0;
    transition: color 0.15s;
}

.cc-sa-hours-toggle:hover {
    color: #333333;
}

.cc-sa-chevron {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.cc-sa-hours-table {
    width: 100%;
    max-width: 300px;
    border-collapse: collapse;
    margin-top: 6px;
    font-size: 13px;
}

.cc-sa-hours-day {
    font-weight: 600;
    color: #333333;
    padding: 3px 12px 3px 0;
    white-space: nowrap;
}

.cc-sa-hours-time {
    color: #666666;
    padding: 3px 0;
}

/* ── Responsive ─────────────────────────────────── */

@media (max-width: 767px) {
    .cc-sa-modal {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }

    .cc-sa-store-list {
        max-height: none;
        flex: 1;
    }

    .cc-sa-modal-header {
        padding: 16px;
    }

    .cc-sa-search-bar,
    .cc-sa-toggle-bar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .cc-sa-store-item {
        padding: 14px 16px;
    }
}
