/* Instagram-style Modern Design - Minimalist Version */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables for Theme Management */
:root {
    /* Minimalist Colors - Soft and Clean */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #8b5cf6;
    
    /* Background Colors */
    --bg-primary: #fafbfc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --bg-card: #ffffff;
    --bg-hover: rgba(102, 126, 234, 0.04);
    --bg-subtle: #f1f3f4;
    
    /* Text Colors */
    --text-primary: #1a202c;
    --text-secondary: #718096;
    --text-muted: #a0aec0;
    --text-white: #ffffff;
    
    /* Border Colors */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --border-focus: #667eea;
    
    /* Shadow - Softer */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 50%;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Transitions */
    --transition: all 0.2s ease-in-out;
    --transition-slow: all 0.3s ease-in-out;
    
    /* Mobile Specific Variables */
    --mobile-header-height: 56px;
    --mobile-touch-target: 44px;
    --mobile-spacing: 16px;
    --mobile-border-radius: 12px;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    /* Background Colors */
    --bg-primary: #0f1419;
    --bg-secondary: #1a202c;
    --bg-tertiary: #2d3748;
    --bg-card: #2d3748;
    --bg-hover: rgba(102, 126, 234, 0.1);
    --bg-subtle: #4a5568;
    
    /* Text Colors */
    --text-primary: #f7fafc;
    --text-secondary: #cbd5e0;
    --text-muted: #a0aec0;
    
    /* Border Colors */
    --border-color: #4a5568;
    --border-light: #2d3748;
    
    /* Shadow - Darker */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px; /* Reduced from 16px for better mobile experience */
    scroll-behavior: smooth;
    /* Prevent zoom on iOS */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: var(--transition);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent bounce scrolling on iOS */
    overscroll-behavior: none;
    /* Improve touch scrolling */
    -webkit-overflow-scrolling: touch;
}

/* Typography - Mobile First */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

h1 { 
    font-size: 1.75rem; /* Reduced from 2.5rem */
}

h2 { 
    font-size: 1.5rem; /* Reduced from 2rem */
}

h3 { 
    font-size: 1.25rem; /* Reduced from 1.75rem */
}

h4 { 
    font-size: 1.125rem; /* Reduced from 1.5rem */
}

h5 { 
    font-size: 1rem; /* Reduced from 1.25rem */
}

h6 { 
    font-size: 0.875rem; /* Reduced from 1rem */
}

/* Desktop sizes */
@media (min-width: 768px) {
    h1 { font-size: 2.25rem; }
    h2 { font-size: 1.875rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    h5 { font-size: 1.125rem; }
    h6 { font-size: 1rem; }
}

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@media (min-width: 768px) {
    p {
        font-size: 1rem;
    }
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
    /* Improve touch targets */
    min-height: var(--mobile-touch-target);
    display: inline-flex;
    align-items: center;
}

a:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

/* Layout Components */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: var(--spacing-md);
    margin-left: 0;
    padding-top: var(--mobile-header-height);
    transition: var(--transition);
}

@media (min-width: 768px) {
    .main-content {
        margin-left: 280px;
        padding: var(--spacing-xl);
        padding-top: 60px;
    }
}

/* New Full-width Main Content */
.main-content-fullwidth {
    flex: 1;
    padding-left: var(--spacing-sm);
    padding-right: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    padding-top: 56px; /* Bootstrap navbar 실제 높이만 - 최소 여백 */
    width: 100%;
    min-height: 100vh;
}

@media (min-width: 992px) {
    .main-content-fullwidth {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
        padding-bottom: var(--spacing-md);
        padding-top: 56px; /* Bootstrap navbar 실제 높이만 - 최소 여백 */
    }
}

/* 기본 네비게이션 스타일 최소화 - Bootstrap 우선 */
.navbar-brand {
    font-weight: 700 !important;
}

/* Navbar 기본 스타일 - iOS Safari 호환성 향상 */
.navbar {
    background-color: #ffffff !important; /* fallback for light theme */
    border-bottom: 1px solid #e2e8f0 !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* iOS Safari support */
}

/* 라이트 테마 navbar */
[data-theme="light"] .navbar {
    background-color: var(--bg-secondary, #ffffff) !important;
    border-bottom-color: var(--border-light, #f1f5f9) !important;
}

/* 다크 테마 navbar */
[data-theme="dark"] .navbar {
    background-color: var(--bg-secondary, #2d3748) !important;
    border-bottom-color: var(--border-color, #4a5568) !important;
}

/* Navbar 드롭다운 메뉴 배경 */
.navbar-collapse {
    background-color: inherit !important;
}

/* 라이트 테마 네비게이션 링크 */
[data-theme="light"] .navbar-nav .nav-link {
    color: var(--text-primary, #1a202c) !important;
}

[data-theme="light"] .navbar-nav .nav-link:hover,
[data-theme="light"] .navbar-nav .nav-link:focus {
    color: var(--primary-color, #667eea) !important;
}

/* 다크 테마 네비게이션 링크 */
[data-theme="dark"] .navbar-nav .nav-link {
    color: var(--text-primary, #f7fafc) !important;
}

[data-theme="dark"] .navbar-nav .nav-link:hover,
[data-theme="dark"] .navbar-nav .nav-link:focus {
    color: var(--primary-color, #667eea) !important;
}

/* 햄버거 메뉴 아이콘 - 다크 테마 */
[data-theme="dark"] .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(247, 250, 252, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='m4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* 햄버거 메뉴 아이콘 - 라이트 테마 */
[data-theme="light"] .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(33, 37, 41, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='m4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* 햄버거 메뉴 버튼 자체 스타일링 */
.navbar-toggler {
    border: 1px solid var(--border-color, #e2e8f0) !important;
    background-color: transparent !important;
}

[data-theme="dark"] .navbar-toggler {
    border-color: var(--border-color, #4a5568) !important;
}

/* 드롭다운 메뉴 배경 강화 - iOS Safari 호환성 */
.dropdown-menu {
    background-color: var(--bg-card, #ffffff) !important;
    border: 1px solid var(--border-light, #f1f5f9) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-card, #2d3748) !important;
    border-color: var(--border-color, #4a5568) !important;
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary, #f7fafc) !important;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--bg-hover, rgba(102, 126, 234, 0.1)) !important;
    color: var(--text-primary, #f7fafc) !important;
}

/* iOS Safari 특별 처리 */
@supports (-webkit-appearance: none) {
    .navbar {
        position: -webkit-sticky !important;
        position: sticky !important;
        z-index: 1020 !important;
    }
}

/* iOS 기기 전용 스타일 */
.ios-device .navbar {
    /* iOS에서 고정 헤더 문제 해결 */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1030 !important;
}

.ios-device .navbar-collapse {
    /* iOS에서 드롭다운 배경 강화 */
    background-color: inherit !important;
    border-radius: 0 0 8px 8px !important;
    margin-top: 1px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

/* iOS Safari에서 안전 영역 처리 */
@media screen and (max-device-width: 812px) and (-webkit-min-device-pixel-ratio: 2) {
    .navbar {
        padding-top: env(safe-area-inset-top, 0) !important;
        padding-left: env(safe-area-inset-left, 1rem) !important;
        padding-right: env(safe-area-inset-right, 1rem) !important;
    }
}

.navbar-brand {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
}

@media (min-width: 768px) {
    .navbar-brand {
        font-size: 1.5rem;
    }
}

/* Enhanced Mobile Sidebar */
.sidebar {
    position: fixed;
    top: var(--mobile-header-height);
    left: 0;
    width: 100%;
    max-width: 320px;
    height: calc(100vh - var(--mobile-header-height));
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: var(--mobile-spacing);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    /* Add backdrop blur */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sidebar.show {
    transform: translateX(0);
}

@media (min-width: 768px) {
    .sidebar {
        top: 60px;
        width: 280px;
        height: calc(100vh - 60px);
        padding: var(--spacing-lg);
        transform: translateX(0);
    }
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

@media (min-width: 768px) {
    .sidebar-overlay {
        display: none;
    }
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    margin-bottom: var(--spacing-xs);
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--mobile-border-radius);
    transition: var(--transition);
    font-weight: 500;
    /* Ensure minimum touch target */
    min-height: var(--mobile-touch-target);
}

.sidebar-nav-link:hover,
.sidebar-nav-link.active {
    background: var(--bg-hover);
    color: var(--primary-color);
    transform: translateX(4px);
}

.sidebar-nav-link i {
    margin-right: var(--spacing-md);
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Enhanced Card Styles */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--mobile-border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

@media (min-width: 768px) {
    .card {
        border-radius: var(--radius-lg);
    }
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    padding: var(--mobile-spacing);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

@media (min-width: 768px) {
    .card-header {
        padding: var(--spacing-lg);
    }
}

.card-body {
    padding: var(--mobile-spacing);
}

@media (min-width: 768px) {
    .card-body {
        padding: var(--spacing-lg);
    }
}

.card-footer {
    padding: var(--mobile-spacing);
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

@media (min-width: 768px) {
    .card-footer {
        padding: var(--spacing-lg);
    }
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .card-title {
        font-size: 1.25rem;
    }
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

/* Enhanced Grid System */
.grid {
    display: grid;
    gap: var(--mobile-spacing);
}

@media (min-width: 768px) {
    .grid {
        gap: var(--spacing-lg);
    }
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: repeat(1, 1fr);
    }
}

/* Enhanced Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--mobile-border-radius);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    /* Ensure minimum touch target */
    min-height: var(--mobile-touch-target);
    min-width: var(--mobile-touch-target);
    /* Prevent text selection */
    user-select: none;
    -webkit-user-select: none;
    /* Improve touch response */
    -webkit-tap-highlight-color: transparent;
}

@media (min-width: 768px) {
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        border-radius: var(--radius-md);
    }
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--text-white);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: var(--text-white);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
    min-height: 36px;
}

@media (min-width: 768px) {
    .btn-sm {
        padding: 6px 12px;
        font-size: 0.875rem;
    }
}

.btn-lg {
    padding: 16px 24px;
    font-size: 1rem;
    min-height: 52px;
}

@media (min-width: 768px) {
    .btn-lg {
        padding: 12px 24px;
        font-size: 1.125rem;
    }
}

/* Enhanced Form Styles */
.form-group {
    margin-bottom: var(--mobile-spacing);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--mobile-border-radius);
    transition: var(--transition);
    /* Ensure minimum touch target */
    min-height: var(--mobile-touch-target);
    /* Prevent zoom on iOS */
    font-size: 16px;
}

@media (min-width: 768px) {
    .form-control {
        padding: 10px 12px;
        font-size: 0.9rem;
        border-radius: var(--radius-md);
    }
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* Enhanced Table Styles */
.table-container {
    background: var(--bg-card);
    border-radius: var(--mobile-border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    /* Enable horizontal scrolling on mobile */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .table-container {
        border-radius: var(--radius-lg);
    }
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    /* Minimum width to prevent cramping */
    min-width: 600px;
}

@media (min-width: 768px) {
    .table {
        font-size: 0.9rem;
        min-width: auto;
    }
}

.table th,
.table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

@media (min-width: 768px) {
    .table th,
    .table td {
        padding: 12px 16px;
        white-space: normal;
    }
}

.table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

@media (min-width: 768px) {
    .table th {
        font-size: 0.8rem;
    }
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

.table tbody tr:hover td {
    color: var(--text-primary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Mobile table styles - 비활성화 (AUM 페이지는 자체 스타일 사용) */
/* @media (max-width: 767px) {
    .table-responsive-stack {
        display: block;
        min-width: auto;
    }
    
    .table-responsive-stack thead {
        display: none;
    }
    
    .table-responsive-stack tbody,
    .table-responsive-stack tr,
    .table-responsive-stack td {
        display: block;
        width: 100%;
    }
    
    .table-responsive-stack tr {
        border: 1px solid var(--border-color);
        border-radius: var(--mobile-border-radius);
        margin-bottom: var(--spacing-md);
        padding: var(--spacing-md);
        background: var(--bg-card);
    }
    
    .table-responsive-stack td {
        border: none;
        padding: var(--spacing-sm) 0;
        text-align: left;
        white-space: normal;
    }
    
    .table-responsive-stack td:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--text-primary);
        display: inline-block;
        width: 100px;
    }
} */

/* Dark theme table adjustments */
[data-theme="dark"] .table {
    color: var(--text-secondary);
}

[data-theme="dark"] .table th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .table td {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .table tbody tr:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .table tbody tr:hover td {
    color: var(--text-primary);
}

/* Dark theme form adjustments */
[data-theme="dark"] .form-control {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--border-focus);
    background: var(--bg-secondary);
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .form-select {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-select:focus {
    border-color: var(--border-focus);
    background: var(--bg-secondary);
}

/* Enhanced Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* Ensure minimum touch target for interactive badges */
    min-height: 24px;
}

@media (min-width: 768px) {
    .badge {
        padding: 4px 12px;
        font-size: 0.8rem;
    }
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.badge-secondary {
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

/* Enhanced Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--mobile-spacing);
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--spacing-lg);
    }
}

.stat-card {
    background: var(--bg-card);
    padding: var(--mobile-spacing);
    border-radius: var(--mobile-border-radius);
    border: 1px solid var(--border-color);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

@media (min-width: 768px) {
    .stat-card {
        padding: var(--spacing-lg);
        border-radius: var(--radius-lg);
    }
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

@media (min-width: 768px) {
    .stat-number {
        font-size: 2rem;
    }
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

@media (min-width: 768px) {
    .stat-label {
        font-size: 0.875rem;
    }
}

/* Animations */
/* @keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
} */
/* fadeIn 애니메이션 비활성화 - F5 레이아웃 변경 방지 */

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* .fade-in {
    animation: fadeIn 0.5s ease-out;
} */
/* fade-in 클래스 비활성화 - 레이아웃 안정성을 위해 */

.slide-in {
    animation: slideIn 0.3s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Loading States */
.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Mobile-specific responsive adjustments */
@media (max-width: 768px) {
    .main-content {
        padding: var(--mobile-spacing);
        padding-top: calc(var(--mobile-header-height) + var(--mobile-spacing));
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .stat-card {
        padding: var(--spacing-md);
    }

    .stat-number {
        font-size: 1.25rem;
    }

    .table-container {
        margin: 0 calc(-1 * var(--mobile-spacing));
        border-radius: 0;
    }

    .table {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .table {
        font-size: 0.7rem;
    }

    .navbar-brand {
        font-size: 1rem;
    }
}

/* Enhanced Theme Toggle */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Ensure touch target */
    min-height: var(--mobile-touch-target);
    min-width: var(--mobile-touch-target);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary { background-color: var(--bg-primary) !important; }
.bg-secondary { background-color: var(--bg-secondary) !important; }
.bg-card { background-color: var(--bg-card) !important; }

.border { border: 1px solid var(--border-color) !important; }
.border-0 { border: none !important; }
.border-top { border-top: 1px solid var(--border-color) !important; }
.border-bottom { border-bottom: 1px solid var(--border-color) !important; }

.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.m-0 { margin: 0 !important; }
.mt-auto { margin-top: auto !important; }
.mb-auto { margin-bottom: auto !important; }

.p-0 { padding: 0 !important; }
.p-sm { padding: var(--spacing-sm) !important; }
.p-md { padding: var(--spacing-md) !important; }
.p-lg { padding: var(--spacing-lg) !important; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

/* Mobile-specific utility classes */
@media (max-width: 768px) {
    .d-mobile-none { display: none !important; }
    .d-mobile-block { display: block !important; }
    .d-mobile-flex { display: flex !important; }
    
    .text-mobile-center { text-align: center !important; }
    .text-mobile-left { text-align: left !important; }
    
    .p-mobile-sm { padding: var(--spacing-sm) !important; }
    .p-mobile-md { padding: var(--spacing-md) !important; }
    
    .m-mobile-0 { margin: 0 !important; }
    .m-mobile-sm { margin: var(--spacing-sm) !important; }
}

/* Print styles */
@media print {
    .sidebar,
    .navbar,
    .theme-toggle,
    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* ==============================================
   MOBILE-SPECIFIC ENHANCEMENTS
   ============================================== */

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    .btn:hover,
    .card:hover,
    .stat-card:hover,
    .sidebar-nav-link:hover {
        transform: none;
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    .card:active,
    .stat-card:active {
        transform: scale(0.99);
    }
}

/* Improved focus states for keyboard navigation */
.btn:focus-visible,
.form-control:focus-visible,
.sidebar-nav-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Safe area insets for devices with notches */
@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(var(--mobile-spacing), env(safe-area-inset-left));
        padding-right: max(var(--mobile-spacing), env(safe-area-inset-right));
    }
    
    .sidebar {
        padding-left: max(var(--mobile-spacing), env(safe-area-inset-left));
    }
    
    .main-content {
        padding-left: max(var(--mobile-spacing), env(safe-area-inset-left));
        padding-right: max(var(--mobile-spacing), env(safe-area-inset-right));
        padding-bottom: max(var(--mobile-spacing), env(safe-area-inset-bottom));
    }
}

/* Improved scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

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

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-tertiary);
}

/* Mobile pull-to-refresh prevention */
body {
    overscroll-behavior-y: contain;
}

/* Improved text selection */
::selection {
    background: rgba(102, 126, 234, 0.2);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(102, 126, 234, 0.2);
    color: var(--text-primary);
}

/* Mobile-optimized modal styles */
@media (max-width: 768px) {
    .modal-dialog {
        margin: var(--mobile-spacing);
        max-width: calc(100% - 2 * var(--mobile-spacing));
    }
    
    .modal-content {
        border-radius: var(--mobile-border-radius);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--mobile-spacing);
    }
}

/* Improved accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-primary: #000000;
        --text-secondary: #333333;
    }
    
    [data-theme="dark"] {
        --border-color: #ffffff;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
    }
}
