@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #64748b;
    --bg-dark: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --glass: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Sidebar Variables */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --sidebar-current-width: var(--sidebar-width);
    --transition-speed: 0.3s;
}

/* Sidebar Collapsed State Context */
.sidebar-collapsed {
    --sidebar-current-width: var(--sidebar-collapsed-width);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
}

h1,
h2,
h3,
h4,
.navbar-brand {
    font-family: 'Outfit', sans-serif;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Navigation */
.navbar {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    margin-left: var(--sidebar-current-width);
    transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-brand {
    font-weight: 700;
    color: var(--text-main) !important;
    letter-spacing: -0.5px;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-current-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding-top: 5rem;
    padding-bottom: 2rem;
    transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
}

/* Sidebar Toggle Button Container */
.sidebar-toggle-container {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-start;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-collapsed .sidebar-toggle-container {
    justify-content: center;
    padding: 1rem 0;
}

/* Sidebar scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

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

.nav-link {
    color: var(--text-muted);
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
    border-radius: 0.5rem;
    margin: 0.2rem 1rem;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link i {
    font-size: 1.25rem;
    min-width: 1.5rem;
    display: flex;
    justify-content: center;
}

.nav-link span {
    transition: opacity var(--transition-speed);
    opacity: 1;
}

/* Collapsed nav link adjustments */
.sidebar-collapsed .nav-link {
    padding: 0.8rem 0;
    justify-content: center;
    margin: 0.2rem 0.5rem;
}

.sidebar-collapsed .nav-link span,
.sidebar-collapsed .sidebar h6,
.sidebar-collapsed .nav-link .badge {
    display: none;
    opacity: 0;
}

/* Main Content Area */
.main-wrapper {
    margin-left: var(--sidebar-current-width);
    padding: 6.5rem 2rem 2rem;
    min-height: 100vh;
    transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    width: auto;
}

/* Login Page Specific */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #1e1b4b, #0f172a);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.btn-primary {
    background-color: var(--primary);
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.form-control {
    background-color: var(--surface-light);
    border: 1px solid var(--border);
    color: white;
    padding: 0.75rem 1rem;
}

.form-control:focus {
    background-color: var(--surface-light);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    color: white;
}

/* Dashboard Widgets */
.stat-card {
    padding: 1.5rem;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.icon-blue {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.icon-purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.icon-indigo {
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
}

/* ── 관리 버튼 크기 고정 ── */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0.4rem;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    text-decoration: none;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.btn-action-edit:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #818cf8;
    border-color: rgba(99, 102, 241, 0.3);
}

.btn-action-warning:hover {
    background: rgba(245, 158, 11, 0.25);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
}

.btn-action-danger {
    color: #f87171;
}

.btn-action-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-action-success:hover {
    background: rgba(16, 185, 129, 0.25);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.btn-action.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── 다크 테마 전역 보완 ── */
/* Bootstrap dark 테마가 적용되더라도 커스텀 배경 보완 */
.form-control,
.form-select {
    background-color: var(--surface-light) !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--surface-light) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
    color: var(--text-main) !important;
}

/* 드롭다운 옵션 다크 */
.form-select option {
    background-color: var(--surface);
    color: var(--text-main);
}

/* 테이블 다크 커스텀 */
.table-dark-custom {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    color: var(--text-main);
}

.table-dark-custom thead th {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.table-dark-custom tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
}

.table-dark-custom tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* 페이지네이션 다크 */
.page-link {
    background-color: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text-muted) !important;
}

.page-link:hover {
    background-color: var(--surface-light) !important;
    color: white !important;
}

.page-item.active .page-link {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

.page-item.disabled .page-link {
    opacity: 0.4;
}