/**
 * Custom UI Components CSS
 * Toast, Confirm, Alert Modal Styles
 * Extracted from style.css for reusability
 */

/* ========================================
   Toast 알림
   ======================================== */
#toastContainer {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-item {
    min-width: 280px;
    max-width: 400px;
    padding: 14px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: toastSlideIn 0.3s ease;
}

.toast-item.toast-success { background-color: #22c55e; }
.toast-item.toast-error   { background-color: #ef4444; }
.toast-item.toast-warning { background-color: #f59e0b; }
.toast-item.toast-info    { background-color: #3b82f6; }

.toast-item.toast-hide {
    animation: toastSlideOut 0.3s ease forwards;
}

.toast-message {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ========================================
   Confirm 모달
   ======================================== */
.confirm-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.confirm-overlay.show {
    display: flex;
}

.confirm-box {
    background: #fff;
    border-radius: 12px;
    padding: 30px 40px;
    min-width: 320px;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: confirmFadeIn 0.2s ease;
}

.confirm-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
}

.confirm-icon.type-create  { background-color: #22c55e; }
.confirm-icon.type-update  { background-color: #3b82f6; }
.confirm-icon.type-delete  { background-color: #ef4444; }
.confirm-icon.type-info    { background-color: #6b7280; }
.confirm-icon.type-warning { background-color: #f59e0b; }

.confirm-message {
    font-size: 16px;
    color: #333;
    line-height: 1.6;
    margin-bottom: 25px;
    word-break: keep-all;
    white-space: pre-line;  /* \n 줄바꿈 지원 */
}

.confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-btn {
    padding: 10px 30px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.confirm-btn.confirm-cancel {
    background: #e5e7eb;
    color: #374151;
}

.confirm-btn.confirm-cancel:hover {
    background: #d1d5db;
}

.confirm-btn.confirm-ok {
    background: #940000;
    color: #fff;
}

.confirm-btn.confirm-ok:hover {
    background: #7a0000;
}

.confirm-btn.confirm-ok.type-create  { background: #22c55e; }
.confirm-btn.confirm-ok.type-create:hover { background: #16a34a; }
.confirm-btn.confirm-ok.type-update  { background: #3b82f6; }
.confirm-btn.confirm-ok.type-update:hover { background: #2563eb; }
.confirm-btn.confirm-ok.type-delete  { background: #ef4444; }
.confirm-btn.confirm-ok.type-delete:hover { background: #dc2626; }
.confirm-btn.confirm-ok.type-warning { background: #f59e0b; }
.confirm-btn.confirm-ok.type-warning:hover { background: #d97706; }

@keyframes confirmFadeIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   Alert Modal (확인 버튼만 있는 알림 모달)
   ======================================== */
.alert-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.alert-overlay.show {
    display: flex;
}

.alert-box {
    background: #fff;
    border-radius: 12px;
    padding: 30px 40px;
    min-width: 320px;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: alertFadeIn 0.2s ease;
}

.alert-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
}

.alert-icon.type-success { background-color: #22c55e; }
.alert-icon.type-error   { background-color: #ef4444; }
.alert-icon.type-warning { background-color: #f59e0b; }
.alert-icon.type-info    { background-color: #6b7280; }

.alert-message {
    font-size: 16px;
    color: #333;
    line-height: 1.6;
    margin-bottom: 25px;
    word-break: keep-all;
    white-space: pre-line;  /* \n 줄바꿈 지원 */
}

.alert-buttons {
    display: flex;
    justify-content: center;
}

.alert-btn {
    padding: 10px 30px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.alert-btn.alert-ok {
    background: #940000;
    color: #fff;
}

.alert-btn.alert-ok:hover {
    background: #7a0000;
}

.alert-btn.alert-ok.type-success { background: #22c55e; }
.alert-btn.alert-ok.type-success:hover { background: #16a34a; }
.alert-btn.alert-ok.type-error { background: #ef4444; }
.alert-btn.alert-ok.type-error:hover { background: #dc2626; }
.alert-btn.alert-ok.type-warning { background: #f59e0b; }
.alert-btn.alert-ok.type-warning:hover { background: #d97706; }
.alert-btn.alert-ok.type-info { background: #6b7280; }
.alert-btn.alert-ok.type-info:hover { background: #4b5563; }

@keyframes alertFadeIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   Loading Overlay
   ======================================== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 10001;
}

.loading-overlay.show {
    display: flex;
}

.loading-box {
    background: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: loadingFadeIn 0.2s ease-out;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: loadingSpin 1s linear infinite;
}

.loading-message {
    color: #495057;
    font-size: 14px;
    font-weight: 500;
}

@keyframes loadingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes loadingFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
