/**
 * @fileoverview UI 컴포넌트 스타일시트
 * Alert와 Loading 컴포넌트의 스타일을 정의
 * 
 * @author xebecsoft
 * @since 2024-12
 * 
 * @module custom_ui.css
 */

/* ===== Loading 컴포넌트 ===== */

/* 로딩 컨테이너 */
.custom-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
}

/* 로딩 내부 컨테이너 */
.custom-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 120px;
    padding: 20px;
}

/* 로딩 스피너 */
.custom-loading-spinner {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    width: 100%;
}

/* 로딩 텍스트 */
.custom-loading-text {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    width: 100%;
    text-align: center;
    word-break: keep-all;
}

/* ===== 모던 테마 ===== */
.custom-loading.modern {
    background-color: transparent;
}

.modern .custom-loading-text {
    color: #ffffff;
    font-weight: 500;
}

.modern .spinner-circle {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* ===== Pro 테마 ===== */
.custom-loading.pro {
    background: rgba(245, 245, 247, 0.95);
    backdrop-filter: blur(20px);
}

.pro .custom-loading-container {
    background: #ffffff;
    border-radius: 32px;
    padding: 40px;
    min-width: 240px;
    max-width: 380px;
    box-shadow: 
        20px 20px 60px rgba(190, 190, 190, 0.5),
        -20px -20px 60px rgba(255, 255, 255, 0.8),
        inset 4px 4px 12px rgba(255, 255, 255, 0.9),
        inset -4px -4px 12px rgba(190, 190, 190, 0.25);
}

.pro .custom-loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 32px;
}

.pro .spinner-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: none;
    background: conic-gradient(
        from 0deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0) 25%,
        #6366f1 25%,
        #818cf8 50%,
        rgba(255, 255, 255, 0) 50%
    );
    animation: proSpinnerRotate 1.5s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.pro .spinner-circle::before {
    content: '';
    position: absolute;
    inset: 8px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 
        4px 4px 12px rgba(190, 190, 190, 0.4),
        -4px -4px 12px rgba(255, 255, 255, 0.9);
}

.pro .custom-loading-text {
    color: #374151;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    letter-spacing: -0.2px;
}

.pro .custom-loading-progress {
    width: 100%;
    height: 8px;
    background: #f3f4f6;
    border-radius: 12px;
    margin-top: 32px;
    overflow: hidden;
    box-shadow: 
        inset 2px 2px 4px rgba(190, 190, 190, 0.2),
        inset -2px -2px 4px rgba(255, 255, 255, 0.7);
}

.pro .custom-loading-progress-bar {
    height: 100%;
    border-radius: 12px;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    box-shadow: 2px 0 8px rgba(99, 102, 241, 0.3);
    transition: width 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

/* Alert 스타일 */
.alert-theme-pro .alert-container {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    animation: proSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.alert-theme-pro .alert-title {
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
    margin-bottom: 12px;
}

.alert-theme-pro .alert-message {
    color: #4a5568;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 28px;
}

.alert-theme-pro .alert-buttons {
    display: flex;
    gap: 12px;
}

.alert-theme-pro .alert-button {
    flex: 1;
    height: 44px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.2px;
    border-radius: 8px;
    transition: all 0.15s ease-out;
}

.alert-theme-pro .alert-confirm {
    background: #0066FF;
    color: #ffffff;
}

.alert-theme-pro .alert-confirm:hover {
    background: #0052CC;
}

.alert-theme-pro .alert-cancel {
    background: #f5f5f5;
    color: #4a5568;
}

.alert-theme-pro .alert-cancel:hover {
    background: #e8e8e8;
}

.alert-theme-pro .alert-close-button {
    top: 16px;
    right: -20px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.alert-theme-pro .alert-close-button::before,
.alert-theme-pro .alert-close-button::after {
    width: 14px;
    height: 1.5px;
    background-color: #9ca3af;
    transform-origin: center;
}

.alert-theme-pro .alert-close-button::before {
    transform: rotate(45deg);
}

.alert-theme-pro .alert-close-button::after {
    transform: rotate(-45deg);
}

.alert-theme-pro .alert-close-button:hover::before,
.alert-theme-pro .alert-close-button:hover::after {
    background-color: #4a5568;
}

/* Animations */
@keyframes proSpinner {
    to {
        transform: rotate(360deg);
    }
}

@keyframes proSlideUp {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 미니멀 테마 ===== */
.alert-theme-minimal .alert-container {
    border-radius: 12px;
    background: #fff;
    padding: 24px;
    max-width: 320px;
    text-align: center;
}

.alert-theme-minimal .alert-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    margin-bottom: 16px;
}

.alert-theme-minimal .alert-message {
    font-size: 15px;
    color: #666;
    margin-bottom: 24px;
    line-height: 1.5;
}

.alert-theme-minimal .alert-buttons {
    display: flex;
    gap: 8px;
    padding-top: 0;
    border-top: none;
}

.alert-theme-minimal .alert-button {
    flex: 1;
    height: 44px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
}

.alert-theme-minimal .alert-cancel {
    background: #f1f1f1;
    color: #666;
}

.alert-theme-minimal .alert-confirm {
    background: #dc0000;
    color: #fff;
}

/* 스피너 회전 애니메이션 */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Alert 컴포넌트 ===== */

/* Alert 오버레이 */
.alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    /*background: rgba(0, 0, 0, 0.7);*/
}

/* Alert 컨테이너 */
.alert-container {
    max-width: 100%;
    border-radius: var(--alert-border-radius, 14px);
    opacity: 1;
    transform: scale(0.95) translateY(10px);
    transition: all 0.3s ease;
    will-change: transform, opacity;
    background: #ffffff;
    padding: 20px 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    text-align: left;
    width: 100%;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.alert-border-square .alert-container {
    border-radius: 0;
}

/* Alert 표시 상태 */
.alert-overlay.show {
    opacity: 1;
    visibility: visible;
}

.alert-overlay.show .alert-container {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Alert 아이콘 */
.alert-icon {
    width: 56px;
    height: 56px;
    margin: 8px auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* 헤더 영역 추가 */
.alert-header {
    display: flex;
    justify-content: flex-end;
    margin: -20px -24px 20px -24px;
    padding: 20px 24px;
    border-bottom: 1px solid #f5f5f7;
}

/* Alert 타이틀 */
.alert-title {
	margin-top: 0;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
    color: #1d1d1f;
}

/* Alert 닫기 버튼 */
.alert-close-button {
    position: relative;
    right: 0;
    top: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    z-index: 1;
    transition: transform 0.2s ease;
}

/* X 모양 생성 */
.alert-close-button::before,
.alert-close-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    background-color: #000000;
    transition: background-color 0.2s ease;
}

.alert-close-button::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.alert-close-button::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* 호버 효과 */
.alert-close-button:hover::before,
.alert-close-button:hover::after {
    background-color: #333333;
}

/* 클릭 애니메이션 */
.alert-close-button:active {
    transform: scale(0.9);
}

/* Alert 메시지 */
.alert-message {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 20px;
    color: #86868b;
    overflow-y: auto;
    max-height: calc(90vh - 180px);
}

/* 스크롤바 스타일링 */
.alert-message::-webkit-scrollbar {
    width: 8px;
}

.alert-message::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.alert-message::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

/* Alert 내부 폼 요소 스타일 보존 */
.alert-message .form {
    text-align: left;
    margin: 0;
    padding: 0;
}

.alert-message .form__row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.alert-message .form__column {
    flex: 1;
}

.alert-message .form__input,
.alert-message .form__select {
    width: 100%;
}

.alert-message .form__label {
    display: block;
    margin-bottom: 8px;
}

/* Alert 버튼 영역 */
.alert-buttons {
    margin-top: auto;
    position: sticky;
    display: flex;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid #f5f5f7;
}

/* Alert 버튼 공통 스타일 */
.alert-button {
    padding: 12px 20px;
    border: none;
    border-radius: var(--alert-button-radius, 12px);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex: 1;
    min-height: 44px;
    min-width: 80px;
}

.alert-border-square .alert-button {
    border-radius: 0;
}

/* 확인 버튼 */
.alert-confirm {
    background: #1a4f9f;
    color: white;
}

.alert-confirm:hover {
    background: #0077ED;
}

/* 취소 버튼 */
.alert-cancel {
    background: #f5f5f7;
    color: #1d1d1f;
}

.alert-cancel:hover {
    background: #e8e8ed;
}

/* 추가 버튼 스타일 */
.alert-delete {
    background: #dc3545;
    color: white;
}

.alert-delete:hover {
    background: #c82333;
}

.alert-edit {
    background: #28a745;
    color: white;
}

.alert-edit:hover {
    background: #218838;
}

/* ===== Alert 스타일 변형 ===== */

/* 기본 스타일 */
.alert-style-default .alert-icon {
    background: rgba(0, 113, 227, 0.1);
    color: #0071e3;
}

/* 성공 스타일 */
.alert-style-success .alert-icon {
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
}

/* 에러 스타일 */
.alert-style-error .alert-icon {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

/* ===== Alert 표시 상태 ===== */
.alert-overlay.show {
    opacity: 1;
}

.alert-container.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.alert-border-custom .alert-container {
    border-radius: var(--alert-custom-radius);
}

.alert-border-custom .alert-button {
    border-radius: var(--alert-custom-button-radius);
}

.alert-theme-modern .alert-container {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    padding: 36px;
    max-width: 440px;
    animation: modernSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.alert-theme-modern .alert-header {
    margin: -36px -36px 20px -36px;
    padding: 20px 36px;
}

.alert-theme-modern .alert-title {
    color: #1a202c;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.4px;
    margin-bottom: 14px;
    line-height: 1.3;
}

.alert-theme-modern .alert-message {
    color: #4a5568;
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 28px;
}

.alert-theme-modern .alert-buttons {
    display: flex;
    gap: 14px;
    border-top: none;
    padding-top: 0;
}

.alert-theme-modern .alert-button {
    flex: 1;
    height: 52px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.alert-theme-modern .alert-confirm {
    background: linear-gradient(135deg, #3182ce 0%, #4299e1 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.25);
}

.alert-theme-modern .alert-confirm:hover {
    background: linear-gradient(135deg, #2c5282 0%, #3182ce 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(49, 130, 206, 0.3);
}

.alert-theme-modern .alert-cancel {
    background: #edf2f7;
    color: #2d3748;
}

.alert-theme-modern .alert-cancel:hover {
    background: #e2e8f0;
}

.alert-theme-modern .alert-close-button {
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: #edf2f7;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.alert-theme-modern .alert-close-button:hover {
    background: #e2e8f0;
    transform: rotate(90deg);
}

.alert-theme-modern .alert-close-button::before,
.alert-theme-modern .alert-close-button::after {
    width: 16px;
    height: 2px;
    background-color: #4a5568;
    transition: background-color 0.2s ease;
}

/* Alert 스타일 - Minimal */
.alert-theme-minimal .alert-container {
    background: #ffffff;
    border: 1px solid #f1f1f1;
    border-radius: 4px;
    padding: 32px;
    max-width: 400px;
    animation: minimalFade 0.3s ease-out;
}

.alert-theme-minimal .alert-header {
    margin: -58px -32px 20px -32px;
    padding: 20px 32px;
    border-bottom-color: #f1f1f1;
}

.alert-theme-minimal .alert-title {
    color: #000000;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
}

.alert-theme-minimal .alert-message {
    color: #333333;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.alert-theme-minimal .alert-buttons {
    display: flex;
    gap: 12px;
    border-top: none;
    padding-top: 0;
}

.alert-theme-minimal .alert-button {
    flex: 1;
    height: 44px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
}

.alert-theme-minimal .alert-confirm {
    background: #000000;
    color: #ffffff;
}

.alert-theme-minimal .alert-confirm:hover {
    background: #333333;
}

.alert-theme-minimal .alert-cancel {
    background: #f1f1f1;
    color: #000000;
}

.alert-theme-minimal .alert-cancel:hover {
    background: #e1e1e1;
}

.alert-theme-minimal .alert-close-button {
    top: 16px;
    right: -20px;
    width: 28px;
    height: 28px;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.alert-theme-minimal .alert-close-button:hover {
    opacity: 1;
}

.alert-theme-minimal .alert-close-button::before,
.alert-theme-minimal .alert-close-button::after {
    width: 14px;
    height: 1px;
    background-color: #000000;
}

/* Animations */
@keyframes floatAnimation {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@keyframes modernSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes minimalSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes modernSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes minimalFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== 모바일 반응형 ===== */
@media (max-width: 428px) {
    .alert-overlay {
        padding: 16px;
    }
    
    .alert-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .alert-button {
        width: 100%;
    }
}

/* 프로그레스 바 컨테이너 */
.custom-loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}

/* 프로그레스 바 */
.custom-loading-progress-bar {
    height: 100%;
    background: #ffffff;
    transition: width 0.3s ease;
    width: 0;
}

/* 클래식 테마용 프로그레스 바 */
.classic .custom-loading-progress {
    background-color: #f0f0f0;
    height: 6px;
    border-radius: 3px;
    margin-top: 16px;
}

.classic .custom-loading-progress-bar {
    background-color: #1a4f9f;
    border-radius: 3px;
}

/* +2025.02.19 [엑스트라 버튼 클래스 추가] */

/* Extra button styles for Alert component */
.alert-theme-pro .alert-extra-1 {
  background: #4f46e5;
  color: #ffffff;
}

.alert-theme-pro .alert-extra-1:hover {
  background: #4338ca;
}

.alert-theme-pro .alert-extra-2 {
  background: #10b981;
  color: #ffffff;
}

.alert-theme-pro .alert-extra-2:hover {
  background: #059669;
}

.alert-theme-pro .alert-extra-3 {
  background: #f59e0b;
  color: #ffffff;
}

.alert-theme-pro .alert-extra-3:hover {
  background: #d97706;
}

/* Modern theme extra buttons */
.alert-theme-modern .alert-extra-1 {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.alert-theme-modern .alert-extra-1:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.alert-theme-modern .alert-extra-2 {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.alert-theme-modern .alert-extra-2:hover {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.alert-theme-modern .alert-extra-3 {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.alert-theme-modern .alert-extra-3:hover {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3);
}

/* Minimal theme extra buttons */
.alert-theme-minimal .alert-extra-1 {
  background: #4f46e5;
  color: #ffffff;
}

.alert-theme-minimal .alert-extra-1:hover {
  background: #4338ca;
}

.alert-theme-minimal .alert-extra-2 {
  background: #10b981;
  color: #ffffff;
}

.alert-theme-minimal .alert-extra-2:hover {
  background: #059669;
}

.alert-theme-minimal .alert-extra-3 {
  background: #f59e0b;
  color: #ffffff;
}

.alert-theme-minimal .alert-extra-3:hover {
  background: #d97706;
}

/* Responsive styles for extra buttons */
@media (max-width: 428px) {
  .alert-theme-pro .alert-extra-1,
  .alert-theme-pro .alert-extra-2,
  .alert-theme-pro .alert-extra-3,
  .alert-theme-modern .alert-extra-1,
  .alert-theme-modern .alert-extra-2,
  .alert-theme-modern .alert-extra-3,
  .alert-theme-minimal .alert-extra-1,
  .alert-theme-minimal .alert-extra-2,
  .alert-theme-minimal .alert-extra-3 {
    width: 100%;
    margin-top: 8px;
  }
}