/* Kourai Analysis - Premium UI Design */

:root {
    --bg-primary: #fafbfc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f6f8;
    --bg-hover: #eef0f3;
    --border-color: #e1e4e8;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent-primary: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --sidebar-width: 280px;
    --sidebar-collapsed: 70px;
    --transition-speed: 0.3s;
    --transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: -0.011em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* 사이드바 스타일 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transition: width var(--transition-speed) var(--transition-ease),
        transform var(--transition-speed) var(--transition-ease);
    z-index: 1000;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 65px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    border-radius: 10px;
}

.logo-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: opacity var(--transition-speed) ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    pointer-events: none;
}

.sidebar-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.25s var(--transition-ease);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    margin-left: 0.75rem;
}

.sidebar-toggle:hover {
    background-color: var(--accent-light);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

.sidebar.collapsed .sidebar-toggle {
    margin: 0 auto;
}

.sidebar-nav {
    padding: 1rem;
    overflow-y: auto;
    height: calc(100vh - 65px);
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-speed) ease;
}

.sidebar.collapsed .nav-section-title {
    opacity: 0;
    height: 0;
    margin: 0;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.25s var(--transition-ease);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    font-weight: 500;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-hover));
    border-radius: 0 3px 3px 0;
    transition: height 0.25s var(--transition-ease);
}

.nav-link:hover {
    background-color: var(--accent-light);
    color: var(--accent-primary);
    transform: translateX(2px);
}

.nav-link:hover::before {
    height: 60%;
}

.nav-link.active {
    background: linear-gradient(90deg, var(--accent-light) 0%, transparent 100%);
    color: var(--accent-primary);
    font-weight: 600;
}

.nav-link.active::before {
    height: 80%;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-text {
    transition: opacity var(--transition-speed) ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    pointer-events: none;
}

/* 서브메뉴 스타일 */
.nav-item-with-submenu {
    position: relative;
}

.nav-link-submenu {
    position: relative;
}

.submenu-arrow {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform 0.3s var(--transition-ease);
    flex-shrink: 0;
}

.nav-item-with-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.sidebar.collapsed .submenu-arrow {
    opacity: 0;
    pointer-events: none;
}

.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s var(--transition-ease), opacity 0.3s var(--transition-ease);
    opacity: 0;
    padding-left: 0;
}

.nav-item-with-submenu.open .submenu {
    max-height: 500px;
    opacity: 1;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.submenu-item {
    margin-bottom: 0.125rem;
}

.submenu-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem 0.625rem 3rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.25s var(--transition-ease);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    font-weight: 500;
    font-size: 0.875rem;
}

.submenu-link::before {
    content: '';
    position: absolute;
    left: 2.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.25s var(--transition-ease);
}

.submenu-link:hover {
    background-color: var(--accent-light);
    color: var(--accent-primary);
    transform: translateX(2px);
    padding-left: 3.25rem;
}

.submenu-link:hover::before {
    background: var(--accent-primary);
    width: 6px;
    height: 6px;
}

.submenu-link.active {
    background: linear-gradient(90deg, var(--accent-light) 0%, transparent 100%);
    color: var(--accent-primary);
    font-weight: 600;
}

.submenu-link.active::before {
    background: var(--accent-primary);
    width: 6px;
    height: 6px;
}

.submenu-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.submenu-text {
    transition: opacity var(--transition-speed) ease;
}

.sidebar.collapsed .submenu {
    display: none;
}

/* 메인 콘텐츠 영역 */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    transition: margin-left var(--transition-speed) ease, width var(--transition-speed) ease;
    min-height: 100vh;
}

.sidebar.collapsed+.main-content {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
}

.content-header {
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    min-height: 65px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.content-header>* {
    width: 100%;
}

.content-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.025em;
}

.content-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: -0.011em;
}

.content-body {
    padding: 2rem;
}

.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s var(--transition-ease);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-hover));
    opacity: 0;
    transition: opacity 0.3s var(--transition-ease);
}

.card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card:hover::before {
    opacity: 1;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.card-content {
    color: var(--text-secondary);
    line-height: 1.7;
    letter-spacing: -0.011em;
}

/* 그리드 레이아웃 */
.grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* 버튼 스타일 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--transition-ease);
    text-decoration: none;
    letter-spacing: -0.011em;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--text-muted);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--border-color) 0%, var(--text-muted) 100%);
    border-radius: 10px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--text-muted) 0%, var(--text-secondary) 100%);
}

/* 추가 프리미엄 스타일 */
input[type="text"],
input[type="date"],
input[type="file"],
select,
textarea {
    transition: all 0.3s var(--transition-ease);
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
    outline: none;
}

table {
    border-collapse: separate;
    border-spacing: 0;
}

table thead tr {
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

table tbody tr {
    transition: all 0.2s var(--transition-ease);
}

table tbody tr:hover {
    background-color: var(--accent-light);
    transform: scale(1.001);
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.btn {
    animation: fadeIn 0.4s var(--transition-ease);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .sidebar.collapsed+.main-content {
        margin-left: 0;
        width: 100%;
    }
}