/* 셀리브 테마 CSS - 다크/라이트 모드 완벽 지원 */

:root {
    /* 다크모드 (기본) */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-glass: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b7280;
    --border-color: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.2);
    --input-text: #ffffff;
    --input-placeholder: #9ca3af;
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
}

/* 라이트모드 */
body.light-mode {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-glass: rgba(0, 0, 0, 0.02);
    --text-primary: #1a1a2e;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: rgba(0, 0, 0, 0.1);
    --input-bg: #ffffff;
    --input-border: #d1d5db;
    --input-text: #1a1a2e;
    --input-placeholder: #9ca3af;
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background 0.3s, color 0.3s;
}

/* 그라데이션 배경 */
.gradient-bg {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f1a 100%);
    min-height: 100vh;
}

body.light-mode .gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

/* 글래스 효과 */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

body.light-mode .glass {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* 입력 필드 스타일 */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
input[type="url"],
select,
textarea {
    background: var(--input-bg) !important;
    border: 1px solid var(--input-border) !important;
    color: var(--input-text) !important;
    transition: all 0.2s;
}

input::placeholder,
textarea::placeholder {
    color: var(--input-placeholder) !important;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2) !important;
    outline: none !important;
}

/* 라이트모드 입력필드 강조 */
body.light-mode input[type="text"],
body.light-mode input[type="email"],
body.light-mode input[type="password"],
body.light-mode input[type="tel"],
body.light-mode input[type="number"],
body.light-mode input[type="date"],
body.light-mode input[type="datetime-local"],
body.light-mode input[type="search"],
body.light-mode input[type="url"],
body.light-mode select,
body.light-mode textarea {
    background: #ffffff !important;
    border: 2px solid #e5e7eb !important;
    color: #1a1a2e !important;
}

body.light-mode input:focus,
body.light-mode select:focus,
body.light-mode textarea:focus {
    border-color: #8b5cf6 !important;
    background: #ffffff !important;
}

/* 드롭다운 옵션 스타일 */
select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px;
}

/* 다크모드 드롭다운 */
select option {
    background: #1a1a2e;
    color: #ffffff;
}

body.light-mode select option {
    background: #ffffff;
    color: #1a1a2e;
}

/* 체크박스/라디오 */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
}

/* 테이블 */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
}

th {
    color: var(--text-secondary);
    font-weight: 500;
}

tr {
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background: var(--bg-glass);
}

/* 버튼 */
button, .btn {
    transition: all 0.2s;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 스크롤바 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 테마 토글 버튼 */
.theme-toggle {
    position: fixed;
    top: 12px;
    right: 15px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
    border-color: var(--accent);
}

/* 네비게이션 */
.nav-item {
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.nav-item.active {
    color: var(--accent);
    background: rgba(139, 92, 246, 0.15);
    border-left: 3px solid var(--accent);
}

/* 카드 hover 효과 */
.card-hover {
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.2);
}

/* 뱃지 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

/* 로딩 스피너 */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 펄스 애니메이션 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 모달 오버레이 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.light-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.5);
}

/* 알럿 색상 */
.alert-success { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.alert-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.alert-error { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.alert-info { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }

/* 텍스트 색상 유틸리티 */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }

/* 라이트모드 텍스트 강제 적용 */
body.light-mode p,
body.light-mode span,
body.light-mode div,
body.light-mode h1,
body.light-mode h2,
body.light-mode h3,
body.light-mode h4,
body.light-mode h5,
body.light-mode h6,
body.light-mode label,
body.light-mode td,
body.light-mode th {
    color: inherit;
}

body.light-mode .text-white {
    color: var(--text-primary) !important;
}
/* 헤더 테마버튼 공간 확보 */
header.glass nav {
    padding-right: 50px;
}

/* 반응형 */
@media (max-width: 768px) {
    .theme-toggle {
        top: 14px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    .mobile-header {
        padding-right: 60px !important;
    }

}

/* 모바일 사이드바 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    .sidebar-overlay.open {
        display: block;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .mobile-header {
        display: flex !important;
    }
}
@media (min-width: 769px) {
    .mobile-header {
        display: none !important;
    }
    .sidebar-overlay {
        display: none !important;
    }
}