/* Care - 모달 & 토스트 (v2 — Modern SaaS) */

/* ── 모달 ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--bf-transition), visibility var(--bf-transition);
    padding: var(--bf-space-4);
}

[data-theme="dark"] .modal-overlay {
    background-color: rgba(0, 0, 0, 0.75);
}

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

.modal {
    background-color: var(--bf-bg-modal, #ffffff);
    border-radius: var(--bf-radius-2xl);
    box-shadow: var(--bf-shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    transform: translateY(12px) scale(0.97);
    transition: transform var(--bf-transition-slow);
    position: relative;
    isolation: isolate; /* 자체 stacking context — 부모 backdrop-filter 영향 차단 */
    /* Header/footer 고정, body 스크롤 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal .modal-header,
.modal .modal-footer {
    flex-shrink: 0;
}

.modal .modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
}

[data-theme="dark"] .modal {
    background-color: #162032;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--bf-space-5) var(--bf-space-6);
    border-bottom: 1px solid var(--bf-border-light);
}

.modal-title {
    font-size: var(--bf-text-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bf-text-muted);
    border-radius: var(--bf-radius);
    transition: all var(--bf-transition);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.25rem;
}

.modal-close:hover {
    color: var(--bf-text);
    background-color: var(--bf-bg-hover);
}

.modal-body {
    padding: var(--bf-space-5) var(--bf-space-6);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--bf-space-3);
    padding: var(--bf-space-5) var(--bf-space-6);
    border-top: 1px solid var(--bf-border-light);
    background-color: var(--bf-bg-modal, #ffffff);
}

/* ── 토스트 알림 ── */
.toast-container {
    position: fixed;
    top: var(--bf-space-5);
    right: var(--bf-space-5);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--bf-space-3);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--bf-space-3);
    padding: var(--bf-space-4) var(--bf-space-5);
    /* 다크 배경 + 좌측 8px 컬러 스트라이프 · 사이트 배경(흰색/컬러) 무관하게 대비 확실 */
    background-color: #0f172a;
    color: #f8fafc;
    border-radius: var(--bf-radius-xl);
    box-shadow: 0 10px 28px rgba(0,0,0,0.32), 0 3px 8px rgba(0,0,0,0.16);
    min-width: 320px;
    max-width: 440px;
    animation: toastSlideIn 0.35s var(--bf-transition);
    border: 1px solid rgba(255,255,255,0.06);
    border-left-width: 8px;
    border-left-style: solid;
}

.toast.removing {
    animation: toastSlideOut 0.25s ease forwards;
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    color: #f8fafc;
}

.toast-success .toast-icon { color: #34d399; }
.toast-error .toast-icon   { color: #f87171; }
.toast-warning .toast-icon { color: #fbbf24; }
.toast-info .toast-icon    { color: #60a5fa; }

/* 좌측 컬러 스트라이프 · 상태별 색 */
.toast-success { border-left-color: #10b981; }
.toast-error   { border-left-color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }
.toast-info    { border-left-color: #3b82f6; }

/* 내부 텍스트 색상 override (다크 배경) */
.toast .toast-title   { color: #f8fafc; }
.toast .toast-message { color: #cbd5e1; }
.toast .toast-close   { color: #94a3b8; }
.toast .toast-close:hover { color: #f8fafc; }

/* 다크모드 · toast 반전 (라이트 배경 · 사이트 배경이 어두우니 대비) */
[data-theme="dark"] .toast {
    background-color: #f8fafc;
    color: #0f172a;
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 10px 28px rgba(0,0,0,0.5), 0 3px 8px rgba(0,0,0,0.3);
}
[data-theme="dark"] .toast .toast-title   { color: #0f172a; }
[data-theme="dark"] .toast .toast-message { color: #475569; }
[data-theme="dark"] .toast .toast-close   { color: #64748b; }
[data-theme="dark"] .toast .toast-close:hover { color: #0f172a; }
[data-theme="dark"] .toast-icon { color: #0f172a; }
/* 좌측 스트라이프 색은 라이트/다크 공통 유지 (선명한 컬러) */
[data-theme="dark"] .toast-success .toast-icon { color: #10b981; }
[data-theme="dark"] .toast-error   .toast-icon { color: #ef4444; }
[data-theme="dark"] .toast-warning .toast-icon { color: #f59e0b; }
[data-theme="dark"] .toast-info    .toast-icon { color: #3b82f6; }

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: var(--bf-text-sm);
    font-weight: 600;
    color: var(--bf-text);
}

.toast-message {
    flex: 1;
    font-size: var(--bf-text-sm);
    color: var(--bf-text-secondary);
    line-height: 1.5;
}

.toast-close {
    color: var(--bf-text-muted);
    padding: 2px;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: var(--bf-radius-sm);
    transition: all var(--bf-transition);
    background: none;
    border: none;
}

.toast-close:hover {
    color: var(--bf-text);
    background: var(--bf-bg-hover);
}

/* 토스트 진행 바 */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 var(--bf-radius-xl) var(--bf-radius-xl);
    animation: toastProgress 4s linear forwards;
}

.toast-success .toast-progress { background: var(--bf-success); }
.toast-error .toast-progress   { background: var(--bf-danger); }
.toast-warning .toast-progress { background: var(--bf-warning); }
.toast-info .toast-progress    { background: var(--bf-info); }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(40px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(40px) scale(0.95); }
}

@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ── 스켈레톤 로딩 ── */
.skeleton {
    background: linear-gradient(90deg, var(--bf-bg-hover) 25%, var(--bf-bg-active) 50%, var(--bf-bg-hover) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--bf-radius);
}

.skeleton-text {
    height: 14px;
    margin-bottom: var(--bf-space-2);
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: var(--bf-space-3);
}

.skeleton-card {
    height: 120px;
    border-radius: var(--bf-radius-xl);
}

.skeleton-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── 페이지 전환 ── */
.page-enter {
    animation: pageEnter 0.3s var(--bf-transition);
}

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