/* ModVista - Professional Address Modal CSS */

/* 1. Modal Overlay - Perfect centering, full coverage */
.address-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 24px;
    box-sizing: border-box;
    overflow-y: auto;
    /* Allow overlay itself to scroll if needed */
}

.address-modal-overlay.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

/* 2. Modal Content - Professional Card Layout */
.address-modal-content {
    background: var(--bg-dark-3);
    border: 1px solid var(--input-border);
    border-radius: 20px;
    width: 100%;
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 40px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
    position: relative;
    margin: auto;
    box-sizing: border-box;
    outline: none;
    animation: modalSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlide {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Custom Scrollbar for Modal Content */
.address-modal-content::-webkit-scrollbar {
    width: 6px;
}

.address-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.address-modal-content::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

/* 3. Header & UI Elements */
.address-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--input-border);
}

.address-modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.close-modal-btn:hover {
    color: var(--neon-red);
}

/* 4. Form Grid & Row Logic */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2 columns on desktop/tablet */
    gap: 20px;
    width: 100%;
}

.input-group {
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group input {
    width: 100%;
    display: block;
    padding: 16px 20px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    height: 52px;
    transition: var(--transition);
    box-sizing: border-box;
}

.input-group input:focus {
    border-color: var(--neon-red);
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 31, 31, 0.1);
    background-color: rgba(255, 255, 255, 0.02);
}

/* 5. Address Type Selectors */
.address-type-group {
    margin-bottom: 25px;
}

.address-type-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.type-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.type-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: white;
}

.type-options input[type="radio"] {
    accent-color: var(--neon-red);
    width: 18px;
    height: 18px;
}

/* 6. Footer Actions */
.modal-footer {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    padding-top: 20px;
}

.cancel-modal-btn,
.save-modal-btn {
    flex: 1;
    padding: 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cancel-modal-btn {
    background: transparent;
    border: 1px solid var(--input-border);
    color: var(--text-secondary);
}

.save-modal-btn {
    background: var(--neon-red);
    border: 1px solid var(--neon-red);
    color: white;
}

.save-modal-btn:hover {
    box-shadow: 0 0 20px rgba(255, 31, 31, 0.4);
    transform: translateY(-2px);
}

/* 7. Professional Responsive Tweaks */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        /* Switch to 1 column on mobile */
        gap: 0;
    }

    .address-modal-content {
        padding: 20px;
        width: 100%;
        max-height: 95vh;
    }

    .address-modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-footer {
        flex-direction: column;
        /* Stack buttons on mobile */
        gap: 10px;
    }
}

@media (max-height: 600px) {
    .address-modal-content {
        max-height: 85vh;
        /* Safe zone for very short screens */
    }
}