/* ==================== 전역 스타일 ==================== */
:root {
    --primary-color: #4a90e2;
    --primary-dark: #357abd;
    --secondary-color: #5cb85c;
    --danger-color: #d9534f;
    --warning-color: #f0ad4e;
    --info-color: #5bc0de;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --white: #ffffff;
    --gray-light: #f8f9fa;
    --gray: #6c757d;
    --gray-dark: #343a40;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ==================== 컨테이너 ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-wrapper {
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

/* ==================== 헤더 ==================== */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo:hover {
    color: var(--primary-dark);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--dark-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-color);
    color: var(--white);
}

/* ==================== 카드 컴포넌트 ==================== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 1.25rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: var(--gray-light);
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* ==================== 버튼 ==================== */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    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:hover:before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 144, 226, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--secondary-color), #4cae4c);
    color: var(--white);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #c9302c);
    color: var(--white);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #ec971f);
    color: var(--white);
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color), #46b8da);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ==================== 폼 요소 ==================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-control:disabled {
    background: var(--gray-light);
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* ==================== 테이블 ==================== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    background: var(--white);
    border-collapse: collapse;
}

.table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--gray-light);
}

.table-striped tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

/* ==================== 그리드 시스템 ==================== */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ==================== 게임 카드 ==================== */
.game-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.game-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.game-card-body {
    padding: 1.25rem;
}

.game-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.game-card-description {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ==================== 재화 정보 카드 ==================== */
.currency-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.currency-card:hover {
    box-shadow: var(--shadow-lg);
}

.currency-info {
    flex: 1;
}

.currency-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.currency-prices {
    display: flex;
    gap: 2rem;
}

.price-item {
    display: flex;
    flex-direction: column;
}

.price-label {
    font-size: 0.875rem;
    color: var(--gray);
    margin-bottom: 0.25rem;
}

.price-value {
    font-size: 1.125rem;
    font-weight: 600;
}

.price-buy {
    color: var(--danger-color);
}

.price-sell {
    color: var(--secondary-color);
}

.currency-stock {
    text-align: right;
}

.stock-label {
    font-size: 0.875rem;
    color: var(--gray);
}

.stock-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* ==================== 모달 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 9999;
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--dark-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ==================== 알림 메시지 ==================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    animation: slideDown 0.3s;
}

.alert-success {
    background: rgba(92, 184, 92, 0.1);
    border-left: 4px solid var(--secondary-color);
    color: var(--secondary-color);
}

.alert-danger {
    background: rgba(217, 83, 79, 0.1);
    border-left: 4px solid var(--danger-color);
    color: var(--danger-color);
}

.alert-warning {
    background: rgba(240, 173, 78, 0.1);
    border-left: 4px solid var(--warning-color);
    color: var(--warning-color);
}

.alert-info {
    background: rgba(91, 192, 222, 0.1);
    border-left: 4px solid var(--info-color);
    color: var(--info-color);
}

/* ==================== 로딩 스피너 ==================== */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* ==================== 대시보드 통계 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1), rgba(74, 144, 226, 0.05));
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--gray);
    font-size: 0.9rem;
}

/* ==================== 탭 네비게이션 ==================== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
    overflow-x: auto;
}

.tab-link {
    padding: 1rem 1.5rem;
    color: var(--gray);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-link:hover {
    color: var(--primary-color);
}

.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

/* ==================== 사이드바 ==================== */
.sidebar {
    background: var(--white);
    width: 250px;
    height: calc(100vh - 70px);
    position: fixed;
    left: 0;
    top: 70px;
    box-shadow: var(--shadow);
    overflow-y: auto;
    transition: var(--transition);
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-item {
    margin-bottom: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--dark-color);
    text-decoration: none;
    transition: var(--transition);
}

.sidebar-link:hover {
    background: var(--gray-light);
}

.sidebar-link.active {
    background: linear-gradient(90deg, var(--primary-color), transparent);
    color: var(--white);
}

.sidebar-icon {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.main-content {
    margin-left: 250px;
    padding: 2rem;
    min-height: calc(100vh - 70px);
}

/* ==================== 레스폰시브 ==================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .grid-4 {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .currency-prices {
        flex-direction: column;
        gap: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* ==================== 애니메이션 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== 유틸리티 클래스 ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--primary-color); }
.text-success { color: var(--secondary-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-info { color: var(--info-color); }
.text-muted { color: var(--gray); }

.bg-primary { background-color: var(--primary-color); }
.bg-success { background-color: var(--secondary-color); }
.bg-danger { background-color: var(--danger-color); }
.bg-warning { background-color: var(--warning-color); }
.bg-info { background-color: var(--info-color); }
.bg-light { background-color: var(--gray-light); }
.bg-dark { background-color: var(--dark-color); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 3rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.p-5 { padding: 3rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }

.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }