/* ==========================================
   B-Count 정산관리 시스템 - Modern CSS
   ========================================== */

:root {
    /* Modern Brand Colors */
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    --primary-dark: #3730A3;

    --secondary-color: #7C3AED;
    --secondary-light: #F5F3FF;

    --accent-color: #10B981;
    --accent-light: #D1FAE5;

    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #06B6D4;

    /* Neutral Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --bg-gradient: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);

    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;

    --border-color: #E5E7EB;
    --border-light: #F3F4F6;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --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.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 32px;
}

/* ==========================================
   Navbar
   ========================================== */

.navbar {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0;
    border-bottom: 1px solid var(--border-light);
    backdrop-filter: blur(8px);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 32px;
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-brand a:hover {
    transform: translateY(-1px);
}

.logo-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.nav-brand a:hover .logo-icon {
    transform: scale(1.05);
}

.logo-text-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.logo-subtitle {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 8px;
    align-items: center;
}

.nav-menu > li > a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
}

.nav-menu > li > a:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.nav-menu > li > a.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
}

.dropdown-arrow {
    margin-left: 4px;
    transition: transform 0.2s;
}

.nav-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu - Absolute Positioned */
.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: white;
    min-width: 220px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    list-style: none;
    padding: 8px;
    margin: 0;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* CSS는 기본 동작, JavaScript로 개선 */
.nav-dropdown:hover .dropdown-menu {
    display: block;
}

/* JavaScript로 관리되는 open 클래스 */
.nav-dropdown.open .dropdown-menu {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.9rem;
}

.dropdown-menu a:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* 비활성화 메뉴 스타일 */
.dropdown-menu a.menu-disabled {
    color: #999;
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.dropdown-menu a.menu-disabled small {
    font-size: 0.75rem;
    color: #aaa;
    font-weight: 400;
}

.dropdown-menu a.menu-disabled:hover {
    background: transparent;
    color: #999;
}

.menu-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.dropdown-menu a:hover .menu-icon {
    color: var(--primary-color);
}

/* ==========================================
   Main Content
   ========================================== */

main {
    min-height: calc(100vh - 160px);
    padding: 32px 0;
}

/* ==========================================
   Hero Section
   ========================================== */

.hero-section {
    text-align: center;
    padding: 100px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.hero-section > * {
    position: relative;
    z-index: 1;
}

.hero-section h2 {
    font-size: 3.75rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 24px;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.hero-section h2::after {
    content: '';
    display: block;
    width: 120px;
    height: 6px;
    background: linear-gradient(90deg, #4F46E5 0%, #7C3AED 100%);
    margin: 24px auto 0;
    border-radius: var(--radius-full);
}

.subtitle {
    font-size: 1.375rem;
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ==========================================
   Cards & Info Cards
   ========================================== */

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 28px;
    margin-top: 60px;
    padding: 0 20px;
}

.card {
    background: var(--bg-primary);
    padding: 48px 36px;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4F46E5 0%, #7C3AED 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.card:hover::before {
    transform: scaleX(1);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-2xl);
    border-color: var(--primary-light);
}

.card h3 {
    font-size: 1.625rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.card h3::before {
    content: '';
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    border-radius: 50%;
    flex-shrink: 0;
}

.card p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 1.05rem;
}

/* ==========================================
   Footer
   ========================================== */

footer {
    background: var(--bg-primary);
    color: var(--text-muted);
    text-align: center;
    padding: 40px 0;
    margin-top: 120px;
    border-top: 1px solid var(--border-light);
}

footer p {
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

footer p::before {
    content: '✦';
    margin-right: 8px;
    color: var(--primary-color);
    font-size: 0.7rem;
}

footer p::after {
    content: '✦';
    margin-left: 8px;
    color: var(--primary-color);
    font-size: 0.7rem;
}

/* ==========================================
   Messages
   ========================================== */

.messages {
    margin: 24px 0;
}

.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error,
.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

.alert-info {
    background: #cffafe;
    color: #164e63;
}

/* ==========================================
   Page Styles
   ========================================== */

.page-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h2 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 0;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.page-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
    margin-top: 24px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 32px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    color: white;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.stat-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 4px;
    text-align: right;
}

.stat-amount {
    font-size: 1.5rem;
    font-weight: 600;
    opacity: 0.95;
    text-align: right;
}

.stat-description {
    font-size: 0.875rem;
    opacity: 0.8;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 24px;
}

.content-card {
    background: white;
    padding: 28px;
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-top: 20px;
}

.content-card:first-of-type {
    margin-top: 0;
}

.content-card h3 {
    color: var(--text-primary);
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 20px;
}

/* 테이블 스크롤 컨테이너 */
.table-container {
    max-height: calc(100vh - 400px);
    min-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

/* 스크롤바 스타일링 */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

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

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

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.data-table th {
    background: var(--bg-secondary);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.data-table tbody th {
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.95rem;
}

.data-table tr th:last-child,
.data-table tr td:last-child {
    border-right: none;
}

.data-table td {
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

/* 숫자가 포함된 셀에 tabular-nums 적용 */
.data-table td.text-right,
.data-table th.text-right,
.data-table td.text-center:has(strong),
.stat-number,
.stat-amount {
    font-variant-numeric: tabular-nums;
}

.data-table tbody tr {
    transition: all 0.2s;
}

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

/* 주말 행 스타일 */
/* 토요일 - 연한 파란색 */
.data-table tbody tr.saturday-row {
    background-color: #E3F2FD;
}

.data-table tbody tr.saturday-row:hover {
    background-color: #BBDEFB;
}

/* 일요일 - 연한 붉은색 */
.data-table tbody tr.sunday-row {
    background-color: #FFEBEE;
}

.data-table tbody tr.sunday-row:hover {
    background-color: #FFCDD2;
}

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

.data-table .empty {
    text-align: center;
    color: var(--text-muted);
    padding: 48px;
    font-style: italic;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-processing {
    background: #cffafe;
    color: #164e63;
}

.badge-completed {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fed7aa;
    color: #9a3412;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.filter-section {
    margin-bottom: 0;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.btn,
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn:hover,
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.filter-bar {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ==========================================
   Utility Classes
   ========================================== */

.text-left {
    text-align: left !important;
}

.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 1024px) {
    .container {
        padding: 0 24px;
    }
    
    .nav-menu {
        gap: 4px;
    }
    
    .nav-menu > li > a {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .nav-menu > li > a {
        padding: 10px 12px;
    }
    
    .hero-section h2 {
        font-size: 2rem;
    }
    
    .info-cards,
    .content-grid {
        grid-template-columns: 1fr;
    }
}
