/**
 * Frontend Styles
 *
 * @package Eraclito_PDB_Pro
 * @since 1.7.0
 */

/* Tracking section */
.pdb-tracking-section {
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 20px;
    margin: 20px 0;
    border-radius: 3px;
}

.pdb-tracking-section h2 {
    margin-top: 0;
    color: #333;
    font-size: 24px;
}

.pdb-tracking-section h4 {
    color: #666;
    margin-bottom: 10px;
}

.pdb-tracking-section p {
    line-height: 1.6;
}

.pdb-tracking-code {
    font-weight: bold;
    color: #2271b1;
}

/* Tracking table */
.pdb-tracking-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
}

.pdb-tracking-table thead {
    background: #f6f7f7;
}

.pdb-tracking-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #ddd;
}

.pdb-tracking-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.pdb-tracking-table tbody tr:nth-child(odd) {
    background: #fafafa;
}

.pdb-tracking-table tbody tr:hover {
    background: #f5f5f5;
}

/* Tracking link */
.pdb-tracking-link {
    display: inline-block;
    margin-top: 15px;
    color: #2271b1;
    text-decoration: none;
}

.pdb-tracking-link:hover {
    text-decoration: underline;
}

/* No tracking message */
.pdb-no-tracking {
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-left: 4px solid #ffb900;
    margin: 15px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .pdb-tracking-table {
        font-size: 14px;
    }

    .pdb-tracking-table th,
    .pdb-tracking-table td {
        padding: 8px;
    }
}

/* Checkout field */
.form-row.pdb-presso-field {
    clear: both;
}

.form-row.pdb-presso-field label {
    font-weight: 600;
}

.form-row.pdb-presso-field input {
    width: 100%;
}

/* Pickup Points */
.pdb-pickup-wrapper {
    margin: 20px 0;
    clear: both;
}

/* Toggle Card */
.pdb-pickup-toggle label {
    display: block;
    cursor: pointer;
    margin: 0;
}

.pdb-pickup-toggle-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pdb-pickup-toggle-card:hover {
    border-color: #003399;
    box-shadow: 0 2px 8px rgba(0, 51, 153, 0.1);
}

#pdb-pickup-toggle-cb:checked ~ .pdb-toggle-slider {
    /* handled below */
}

.pdb-pickup-toggle-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pdb-pickup-icon {
    width: 32px;
    height: 32px;
    color: #003399;
    flex-shrink: 0;
}

.pdb-pickup-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pdb-pickup-toggle-title {
    font-weight: 700;
    font-size: 15px;
    color: #1d2327;
}

.pdb-pickup-toggle-desc {
    font-size: 13px;
    color: #646970;
    font-weight: 400;
}

/* Toggle Switch */
.pdb-pickup-toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.pdb-pickup-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.pdb-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 26px;
    transition: background 0.3s;
    cursor: pointer;
}

.pdb-toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.pdb-pickup-toggle-switch input:checked + .pdb-toggle-slider {
    background: #003399;
}

.pdb-pickup-toggle-switch input:checked + .pdb-toggle-slider::before {
    transform: translateX(22px);
}

/* Active state for toggle card */
.pdb-pickup-toggle-card.active {
    border-color: #003399;
    background: #f7f9ff;
}

/* Results Container */
.pdb-pickup-container {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 12px;
    padding: 2px;
}

.pdb-pickup-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Pickup Point Cards */
.pdb-pickup-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 14px 16px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.pdb-pickup-card:hover {
    border-color: #003399;
    box-shadow: 0 2px 8px rgba(0, 51, 153, 0.12);
    transform: translateY(-1px);
}

.pdb-pickup-card.selected {
    border-color: #003399;
    background: linear-gradient(135deg, #f7f9ff 0%, #eef2ff 100%);
    box-shadow: 0 0 0 2px rgba(0, 51, 153, 0.2);
}

.pdb-pickup-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.pdb-pickup-name {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    flex: 1;
}

.pdb-pickup-distance {
    font-size: 12px;
    color: #646970;
    white-space: nowrap;
    background: #f0f0f1;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Badge tipi servizio */
.pdb-pickup-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.pdb-badge-rtz {
    background: #fef3c7;
    color: #92400e;
}

.pdb-badge-apt {
    background: #cffafe;
    color: #155e75;
}

.pdb-badge-fmp {
    background: #d1fae5;
    color: #065f46;
}

.pdb-pickup-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #50575e;
    padding-left: 2px;
}

.pdb-pickup-address::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    vertical-align: -2px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23646970' stroke-width='2'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.pdb-pickup-hours::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    vertical-align: -2px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23757575' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 6v6l4 2'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.pdb-pickup-hours {
    font-size: 12px;
    color: #757575;
}

/* Bottone selezione */
.pdb-pickup-card-action {
    margin-top: 10px;
    text-align: right;
}

.pdb-pickup-select-btn {
    background: #003399;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s, transform 0.15s;
}

.pdb-pickup-select-btn:hover {
    background: #002266;
    transform: translateY(-1px);
}

.selected .pdb-pickup-select-btn {
    background: #065f46;
}

/* Summary */
.pdb-pickup-summary {
    background: linear-gradient(135deg, #f7f9ff 0%, #eef2ff 100%);
    border: 2px solid #003399;
    border-radius: 10px;
    padding: 14px 18px;
    margin-top: 12px;
    font-size: 13px;
}

.pdb-pickup-summary-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

#pdb-pickup-remove {
    color: #d63638;
    text-decoration: none;
    font-size: 12px;
    margin-left: 10px;
    font-weight: 600;
}

#pdb-pickup-remove:hover {
    text-decoration: underline;
}

/* Load More */
.pdb-pickup-load-more-wrap {
    text-align: center;
    margin-top: 12px;
}

.pdb-pickup-load-more-btn {
    background: none;
    border: 2px solid #003399;
    color: #003399;
    padding: 8px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.pdb-pickup-load-more-btn:hover {
    background: #003399;
    color: #fff;
}

/* Loading & Messages */
.pdb-pickup-loading {
    text-align: center;
    color: #646970;
    padding: 24px;
    font-size: 14px;
}

.pdb-pickup-message {
    text-align: center;
    color: #646970;
    padding: 20px;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .pdb-pickup-toggle-card {
        padding: 14px 16px;
    }

    .pdb-pickup-icon {
        width: 26px;
        height: 26px;
    }

    .pdb-pickup-toggle-title {
        font-size: 14px;
    }

    .pdb-pickup-container {
        max-height: 300px;
    }

    .pdb-pickup-card-header {
        flex-wrap: wrap;
        gap: 4px;
    }

    .pdb-pickup-summary-content {
        flex-direction: column;
        align-items: flex-start;
    }
}
