/* 现代化响应式UI样式 */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* 导航栏样式 */
.navbar {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.brand-title-short {
    display: none;
}

.navbar-brand img {
    height: 40px;
    width: auto;
}

.navbar-menu {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.navbar-menu a {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 0.875rem;
}

.navbar-menu a:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.navbar-menu a.active {
    background-color: var(--primary-color);
    color: white;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.green {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* 卡片样式 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* 按钮样式 */
.btn,
button[type="submit"],
button.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.5;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-control:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    background: var(--bg-color);
    cursor: not-allowed;
    opacity: 0.6;
}

textarea.form-control,
textarea {
    min-height: 100px;
    resize: vertical;
}

/* Django表单字段样式 */
label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"] {
    margin-bottom: 0.5rem;
}

/* 错误信息样式 */
.errorlist {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0 0;
    color: var(--error-color);
    font-size: 0.75rem;
}

.errorlist li {
    margin: 0.25rem 0;
}

/* 帮助文本样式 */
.helptext {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    background: var(--card-bg);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.table thead {
    background: var(--bg-color);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.table tbody tr:hover {
    background: var(--bg-color);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* 消息提示 */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    border-color: var(--error-color);
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    border-color: var(--warning-color);
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border-color: var(--info-color);
    color: #1e40af;
}

/* 网格布局 */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* 页面容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.page-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* 登录页面 */
.login-container {
    max-width: 420px;
    margin: 2rem auto;
    padding: 1rem;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img {
    max-height: 120px;
    max-width: 100%;
    margin-bottom: 1rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
}

/* 页脚 */
.footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer p {
    margin: 0.5rem 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 1rem;
    }

    .navbar-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .navbar-brand {
        gap: 0.5rem;
        font-size: 1.125rem;
        max-width: 100%;
    }

    .navbar-brand img {
        height: 32px;
    }

    .brand-title-full {
        display: none;
    }

    .brand-title-short {
        display: inline;
    }
    
    .navbar-menu {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
        scrollbar-width: thin;
    }

    .navbar-menu li {
        flex: 0 0 auto;
    }

    .navbar-menu a {
        display: inline-block;
        white-space: nowrap;
        padding: 0.45rem 0.85rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .table-container {
        overflow-x: scroll;
    }
    
    .login-container {
        margin: 1rem auto;
        padding: 0.5rem;
    }
    
    .login-card {
        padding: 1.5rem 1rem;
    }
    
    .btn,
    button[type="submit"],
    button.btn {
        width: 100%;
        padding: 1rem;
        font-size: 1.125rem;
    }
}

/* 复选框和单选框样式 */
input[type="checkbox"],
input[type="radio"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
    cursor: pointer;
}

/* 文件上传样式 */
input[type="file"] {
    padding: 0.5rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    cursor: pointer;
    width: 100%;
}

input[type="file"]:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

/* 选择框样式 */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    appearance: none;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 徽章样式 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    background: var(--bg-color);
    color: var(--text-secondary);
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1rem;
    margin: 0;
}

