/* ===========================
   커스텀 Modal + Toast 시스템
   =========================== */

/* --- Modal Overlay --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

/* --- Modal Box --- */
.modal-box {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 28px 24px 20px;
    max-width: 400px;
    width: calc(100% - 32px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon {
    text-align: center;
    margin-bottom: 12px;
}

.modal-icon .material-icons {
    font-size: 40px;
    color: var(--primary-color);
}

.modal-message {
    text-align: center;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-line;
    margin: 0 0 20px;
    word-break: keep-all;
    color: var(--text-color);
}

/* --- Modal Buttons --- */
.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
    min-width: 64px;
}

.modal-btn--cancel {
    background: var(--surface-alt-color);
    color: var(--text-secondary-color);
}

.modal-btn--cancel:hover {
    background: var(--border-color);
}

.modal-btn--confirm {
    background: var(--primary-color);
    color: #fff;
}

.modal-btn--confirm:hover {
    background: var(--primary-dark);
}

.modal-btn--danger {
    background: #d32f2f;
    color: #fff;
}

.modal-btn--danger:hover {
    background: #b71c1c;
}

/* --- Toast Container --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

/* --- Toast Item --- */
.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    animation: toastIn 0.25s ease;
    pointer-events: auto;
}

.toast .material-icons {
    font-size: 20px;
    flex-shrink: 0;
}

.toast--success {
    background: #e8f5e9;
    color: #2e7d32;
}

.toast--error {
    background: #ffebee;
    color: #c62828;
}

.toast--info {
    background: #e3f2fd;
    color: #1565c0;
}

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

.toast.toast--out {
    animation: toastOut 0.2s ease forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateY(16px); }
}

/* --- Mobile --- */
@media (max-width: 480px) {
    .modal-box {
        padding: 24px 16px 16px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
        justify-content: center;
    }

    .toast-container {
        left: 16px;
        right: 16px;
        transform: none;
        bottom: 16px;
    }
}
