/* 兑换码生成器 - 主样式文件 */

/* 全局样式 */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition: all 0.15s ease-in-out;
}

/* 基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    line-height: 1.6;
}

/* 导航栏样式 */
.navbar {
    box-shadow: var(--box-shadow);
    border-bottom: 1px solid #dee2e6;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: var(--transition);
    border-radius: var(--border-radius);
    margin: 0 0.25rem;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* 主要内容区域 */
.main-content {
    min-height: calc(100vh - 76px);
    padding: 2rem 0;
}

/* 卡片样式 */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

/* 按钮样式 */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    border-width: 1px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.btn-group .btn {
    transform: none;
}

.btn-group .btn:hover {
    transform: none;
    z-index: 1;
}

/* 表单样式 */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.input-group {
    border-radius: var(--border-radius);
}

.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
}

.input-group .form-control:last-child {
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.input-group-text {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    color: #6c757d;
}

/* 表格样式 */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(0, 0, 0, 0.025);
}

.table-hover > tbody > tr:hover > td {
    background-color: rgba(0, 0, 0, 0.075);
}

/* 代码样式 */
code {
    background-color: #f8f9fa;
    color: #e83e8c;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: 'Courier New', Courier, monospace;
}

.user-select-all {
    user-select: all;
    cursor: pointer;
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-select-all:hover {
    background-color: #e9ecef;
}

/* 徽章样式 */
.badge {
    font-weight: 500;
    border-radius: var(--border-radius);
}

/* 警告框样式 */
.alert {
    border: none;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.alert-primary {
    border-left-color: var(--primary-color);
}

.alert-success {
    border-left-color: var(--success-color);
}

.alert-danger {
    border-left-color: var(--danger-color);
}

.alert-warning {
    border-left-color: var(--warning-color);
}

.alert-info {
    border-left-color: var(--info-color);
}

/* 模态框样式 */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

/* 进度条样式 */
.progress {
    border-radius: var(--border-radius);
    height: 1rem;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: var(--border-radius);
    transition: width 0.3s ease;
}

/* 分页样式 */
.pagination {
    border-radius: var(--border-radius);
}

.page-link {
    border-radius: var(--border-radius);
    margin: 0 0.125rem;
    transition: var(--transition);
}

.page-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
}

/* 工具提示样式 */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    background-color: #212529;
    border-radius: var(--border-radius);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: var(--border-radius) !important;
        margin-bottom: 0.25rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .navbar-nav {
        text-align: center;
    }
    
    .navbar-nav .nav-link {
        margin: 0.25rem 0;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
}

/* 特殊样式 */

/* 仪表盘统计卡片 */
.stats-card {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.stats-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-card p {
    font-size: 1.1rem;
    margin-bottom: 0;
    opacity: 0.9;
}

/* 兑换码显示区域 */
.code-display {
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    margin: 1rem 0;
}

.code-display.has-codes {
    background-color: #d1ecf1;
    border-color: var(--info-color);
}

.code-item {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 0.75rem;
    margin: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.code-item:hover {
    background-color: #f8f9fa;
    border-color: var(--primary-color);
}

.code-text {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    color: var(--primary-color);
    user-select: all;
}

/* 搜索和过滤区域 */
.search-filters {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--box-shadow);
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h4 {
    margin-bottom: 0.5rem;
    color: #495057;
}

.empty-state p {
    margin-bottom: 0;
    font-size: 1.1rem;
}

/* 成功状态样式 */
.success-state {
    text-align: center;
    padding: 2rem 1rem;
    background-color: #d1edff;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.success-state i {
    font-size: 3rem;
    color: var(--success-color);
    margin-bottom: 1rem;
}

/* 登录和设置页面样式 */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    overflow: hidden;
}

.auth-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.auth-header h2 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.auth-header p {
    margin-bottom: 0;
    opacity: 0.9;
}

.auth-body {
    padding: 2rem;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .btn,
    .pagination,
    .modal {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .code-text {
        color: #000 !important;
    }
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #212529;
        --dark-color: #f8f9fa;
    }
    
    body {
        background-color: #212529;
        color: #f8f9fa;
    }
    
    .card {
        background-color: #343a40;
        color: #f8f9fa;
    }
    
    .card-header {
        background-color: #495057;
        border-bottom-color: #6c757d;
    }
    
    .table {
        color: #f8f9fa;
    }
    
    .table th {
        background-color: #495057;
        border-bottom-color: #6c757d;
    }
    
    .form-control,
    .form-select {
        background-color: #495057;
        border-color: #6c757d;
        color: #f8f9fa;
    }
    
    .form-control:focus,
    .form-select:focus {
        background-color: #495057;
        border-color: var(--primary-color);
        color: #f8f9fa;
    }
    
    .input-group-text {
        background-color: #6c757d;
        border-color: #6c757d;
        color: #f8f9fa;
    }
    
    code {
        background-color: #495057;
        color: #f8f9fa;
    }
    
    .modal-content {
        background-color: #343a40;
        color: #f8f9fa;
    }
    
    .modal-header,
    .modal-footer {
        background-color: #495057;
        border-color: #6c757d;
    }
}