/* DD Delivery - Frontend */

/* ===== MODAL ===== */
.dddel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.dddel-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.dddel-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: dddel-slideUp 0.35s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes dddel-slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close button */
.dddel-close-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    z-index: 5;
    padding: 0;
}

.dddel-close-btn:hover {
    background: rgba(0, 0, 0, 0.12);
    color: #333;
}

/* Header */
.dddel-modal-header {
    text-align: center;
    padding: 32px 28px 12px;
}

.dddel-modal-icon {
    font-size: 40px;
    margin-bottom: 8px;
    line-height: 1;
}

.dddel-modal-header h2 {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.dddel-modal-header p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* Body */
.dddel-modal-body {
    padding: 8px 24px 12px;
}

.dddel-search-wrapper {
    position: relative;
}

.dddel-search-wrapper input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.dddel-search-wrapper input:focus {
    border-color: #d1043a;
    box-shadow: 0 0 0 3px rgba(209, 4, 58, 0.1);
}

.dddel-search-wrapper input::placeholder {
    color: #aaa;
}

/* Map in modal */
.dddel-modal-map {
    width: 100%;
    height: 220px;
    border-radius: 10px;
    margin-top: 12px;
    border: 2px solid #e0e0e0;
    z-index: 1;
}

/* Autocomplete dropdown */
.dddel-autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.dddel-autocomplete.active {
    display: block;
}

.dddel-autocomplete-item {
    padding: 12px 16px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.4;
}

.dddel-autocomplete-item:last-child {
    border-bottom: 0;
}

.dddel-autocomplete-item:hover {
    background: #fef2f4;
}

.dddel-autocomplete-item::before {
    content: '📍';
    flex-shrink: 0;
    font-size: 14px;
    margin-top: 1px;
}

.dddel-autocomplete-loading {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: #999;
}

/* Selected address */
.dddel-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0faf0;
    border: 1px solid #c8e6c9;
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 12px;
}

.dddel-selected-icon {
    width: 24px;
    height: 24px;
    background: #2e7d32;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    flex-shrink: 0;
}

.dddel-selected-text {
    flex: 1;
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

.dddel-change-btn {
    background: none;
    border: none;
    color: #d1043a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    flex-shrink: 0;
}

.dddel-change-btn:hover {
    background: rgba(209, 4, 58, 0.08);
}

/* Footer */
.dddel-modal-footer {
    padding: 8px 24px 24px;
}

.dddel-btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: #d1043a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s, transform 0.1s;
    font-family: inherit;
}

.dddel-btn-primary:hover:not(:disabled) {
    background: #b5032f;
}

.dddel-btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.dddel-btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== CHECKOUT ===== */
.dddel-method-disabled {
    opacity: 0.5;
    position: relative;
}

.dddel-method-disabled label {
    cursor: not-allowed !important;
    color: #999 !important;
}

.dddel-method-disabled input[type="radio"] {
    pointer-events: none;
}

.dddel-out-of-range-notice {
    display: block;
    font-size: 12px;
    color: #d32f2f;
    margin-top: 4px;
    padding-left: 24px;
    font-style: italic;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .dddel-modal-content {
        border-radius: 12px;
        max-height: 95vh;
    }

    .dddel-modal-header {
        padding: 28px 20px 8px;
    }

    .dddel-modal-header h2 {
        font-size: 19px;
    }

    .dddel-modal-body,
    .dddel-modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .dddel-modal-map {
        height: 180px;
    }
}
