/**
 * CDEK Widget Styles
 */

/* Modal */
.cdek-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.cdek-modal--open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cdek-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.cdek-modal__body {
    position: relative;
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    max-height: 700px;
    background: #fff;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.cdek-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #E5E5E7;
}

.cdek-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.cdek-modal__close {
    width: 36px;
    height: 36px;
    background: #F5F5F7;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #86868B;
}

.cdek-modal__close:hover {
    background: #E5E5E7;
}

/* Search */
.cdek-modal__search {
    position: relative;
    padding: 16px 24px;
    border-bottom: 1px solid #E5E5E7;
}

.cdek-modal__input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 2px solid #E5E5E7;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.cdek-modal__input:focus {
    border-color: #0071E3;
}

.cdek-modal__suggestions {
    position: absolute;
    top: 100%;
    left: 24px;
    right: 24px;
    background: #fff;
    border: 1px solid #E5E5E7;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
}

.cdek-city-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.cdek-city-suggestion:hover {
    background: #F5F5F7;
}

/* Content */
.cdek-modal__content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.cdek-modal__map {
    flex: 1;
    background: #F5F5F7;
    position: relative;
}

.cdek-modal__loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #86868B;
}

.cdek-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #E5E5E7;
    border-top-color: #0071E3;
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: cdek-spin 0.8s linear infinite;
}

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

.cdek-modal__list {
    width: 320px;
    border-left: 1px solid #E5E5E7;
    overflow-y: auto;
}

/* PVZ Item */
.cdek-pvz-item {
    padding: 16px;
    border-bottom: 1px solid #E5E5E7;
    cursor: pointer;
    transition: background 0.2s;
}

.cdek-pvz-item:hover {
    background: #F5F5F7;
}

.cdek-pvz-item.selected {
    background: rgba(0, 113, 227, 0.1);
    border-left: 3px solid #0071E3;
}

.cdek-pvz-item__name {
    font-weight: 600;
    margin-bottom: 4px;
}

.cdek-pvz-item__address {
    font-size: 13px;
    color: #86868B;
    margin-bottom: 4px;
}

.cdek-pvz-item__time {
    font-size: 12px;
    color: #34C759;
}

/* Footer */
.cdek-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #E5E5E7;
}

.cdek-modal__btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.cdek-modal__btn--cancel {
    background: #F5F5F7;
    color: #1D1D1F;
}

.cdek-modal__btn--cancel:hover {
    background: #E5E5E7;
}

.cdek-modal__btn--select {
    background: #191919;
    color: #fff;
}

.cdek-modal__btn--select:hover:not(:disabled) {
    background: #313131;
}

.cdek-modal__btn--select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading/Error states */
.cdek-loading,
.cdek-error,
.cdek-empty {
    padding: 40px 20px;
    text-align: center;
    color: #86868B;
}

.cdek-error {
    color: #FF3B30;
}

/* Body lock */
body.cdek-modal-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .cdek-modal__body {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
    
    .cdek-modal__content {
        flex-direction: column;
    }
    
    .cdek-modal__map {
        height: 40%;
    }
    
    .cdek-modal__list {
        width: 100%;
        height: 60%;
        border-left: none;
        border-top: 1px solid #E5E5E7;
    }
}
