﻿/* static/style.css - 主要样式文件 */

/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header .logo h1 {
    font-size: 24px;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-info span {
    font-size: 14px;
    opacity: 0.9;
}

/* 导航样式 */
.main-nav {
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 0;
    margin-bottom: 20px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 15px 20px;
    color: #495057;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background-color: #f8f9fa;
    color: #667eea;
}

.nav-link.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background-color: #f8f9fa;
}

.nav-icon {
    margin-right: 8px;
    font-size: 16px;
}

/* 主要内容区域 */
main {
    flex: 1;
    padding: 20px 0;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.card-badge {
    background: #e9ecef;
    color: #495057;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

/* 仪表板网格 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.door-control-card {
    grid-column: 1 / -1;
}

/* 欢迎横幅 */
.welcome-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.welcome-banner h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.current-time {
    font-size: 14px;
    opacity: 0.9;
}

#current-time-large {
    font-size: 18px;
    font-weight: 500;
}

/* 门禁信息 */
.door-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
}

/* 开门控制 */
.door-control-section {
    text-align: center;
    padding: 20px 0;
}

.btn-open-door {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 20px 60px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-open-door:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-open-door:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-open-door.loading {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
}

.door-icon {
    font-size: 28px;
}

.door-text {
    font-size: 18px;
}

.door-hint {
    color: #6c757d;
    font-size: 14px;
    margin-top: 10px;
}

/* 结果区域 */
.result-area {
    margin-top: 20px;
    min-height: 60px;
}

.loading-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: #667eea;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.success-result,
.error-result {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    border-radius: 8px;
    animation: slideIn 0.3s ease;
}

.success-result {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.error-result {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.result-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.result-content h4 {
    margin-bottom: 5px;
}

.result-time {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 5px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 记录列表 */
.logs-list {
    max-height: 300px;
    overflow-y: auto;
}

.log-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.log-item:last-child {
    border-bottom: none;
}

.log-item:hover {
    background-color: #f8f9fa;
}

.log-time {
    flex: 2;
    font-size: 13px;
    color: #6c757d;
}

.log-status {
    flex: 1;
    text-align: center;
}

.log-ip {
    flex: 1;
    font-size: 13px;
    color: #6c757d;
    text-align: right;
}

.status-success {
    color: #28a745;
    font-weight: 500;
}

.status-error {
    color: #dc3545;
    font-weight: 500;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state p {
    margin-bottom: 10px;
}

.empty-hint {
    font-size: 14px;
    opacity: 0.8;
}

/* 使用说明 */
.instructions-list {
    padding-left: 20px;
}

.instructions-list li {
    margin-bottom: 10px;
    color: #495057;
}

/* 快速操作 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.btn-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    color: #495057;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-quick-action:hover {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.2);
}

.action-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.action-text {
    font-size: 14px;
    font-weight: 500;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    gap: 8px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-logout {
    background: #e74c3c;
    color: white;
}

.btn-admin {
    background: #9b59b6;
    color: white;
}

.btn-profile {
    background: #3498db;
    color: white;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* 链接按钮 */
.btn-link {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: 14px;
}

.btn-link:hover {
    color: #5a6fd8;
}

/* 管理后台样式 */
.admin-container {
    padding: 20px 0;
}

.admin-header {
    margin-bottom: 30px;
}

.admin-header h2 {
    font-size: 28px;
    color: #2c3e50;
    margin-bottom: 5px;
}

.admin-subtitle {
    color: #6c757d;
    font-size: 14px;
}

/* 统计面板 */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 36px;
    opacity: 0.8;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: #6c757d;
    margin-top: 5px;
}

/* 标签页 */
.admin-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    color: #6c757d;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: #667eea;
    background-color: #f8f9fa;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 500;
}

.tab-icon {
    font-size: 16px;
}

/* 标签内容 */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.tab-header h3 {
    font-size: 20px;
    color: #2c3e50;
    margin: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.data-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

.data-table td {
    padding: 15px;
    color: #495057;
    font-size: 14px;
}

.success-row {
    background-color: rgba(40, 167, 69, 0.05);
}

.error-row {
    background-color: rgba(220, 53, 69, 0.05);
}

/* 徽章样式 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-admin {
    background: rgba(155, 89, 182, 0.1);
    color: #9b59b6;
}

.badge-user {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.badge-active {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.badge-inactive {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.badge-success {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.badge-error {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-action {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    background: none;
    color: #6c757d;
}

.btn-action:hover {
    background-color: #f8f9fa;
    transform: scale(1.1);
}

.btn-edit:hover {
    color: #3498db;
    background-color: rgba(52, 152, 219, 0.1);
}

.btn-password:hover {
    color: #f39c12;
    background-color: rgba(243, 156, 18, 0.1);
}

.btn-toggle:hover {
    color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

.btn-delete:hover {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
}

.btn-action.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-action.disabled:hover {
    background: none;
    transform: none;
}

.btn-view-response {
    background: none;
    border: 1px solid #667eea;
    color: #667eea;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.btn-view-response:hover {
    background: #667eea;
    color: white;
}

/* 表单样式 */
.form-container {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.admin-form {
    max-width: 800px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #495057;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.form-result {
    margin-top: 20px;
}

/* 搜索样式 */
.search-results {
    margin-top: 30px;
}

.search-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.search-header h4 {
    font-size: 18px;
    color: #2c3e50;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

.modal-content.wide {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    font-size: 18px;
    color: #2c3e50;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: #f8f9fa;
    color: #dc3545;
}

.modal-body {
    padding: 20px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应内容 */
.response-content {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.response-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #495057;
}

/* 密码修改页面 */
.password-change-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 20px;
}

.password-change-box {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 500px;
}

.password-change-header {
    text-align: center;
    margin-bottom: 30px;
}

.password-change-header h2 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.password-change-form .form-group {
    margin-bottom: 25px;
}

.label-icon {
    margin-right: 8px;
    font-size: 16px;
}

/* 密码强度指示器 */
.password-strength {
    margin-top: 10px;
}

.strength-bar {
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin-bottom: 5px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-text {
    font-size: 12px;
    color: #6c757d;
}

.password-match {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 5px;
    transition: color 0.3s ease;
}

/* 密码要求 */
.password-requirements {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 25px 0;
}

.password-requirements h4 {
    font-size: 14px;
    color: #495057;
    margin-bottom: 10px;
}

.password-requirements ul {
    padding-left: 20px;
    margin: 0;
}

.password-requirements li {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 5px;
}

/* 页脚 */
footer {
    margin-top: auto;
    padding: 20px 0;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    border-top: 1px solid #e9ecef;
}

.footer-info {
    font-size: 12px;
    color: #95a5a6;
    margin-top: 5px;
}

/* 消息提示 */
.messages {
    margin: 20px 0;
}

.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    transition: opacity 0.5s ease;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .admin-tabs {
        flex-direction: column;
        border-bottom: none;
    }

    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .tab-btn.active {
        border-left-color: #667eea;
        border-bottom: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .user-info {
        justify-content: flex-start;
        margin-top: 10px;
    }

    .nav-link {
        padding: 12px 15px;
        font-size: 14px;
    }

    .btn-open-door {
        padding: 15px 40px;
        font-size: 18px;
    }

    .modal-content {
        margin: 10px;
    }

    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-panel {
        grid-template-columns: 1fr;
    }

    .welcome-banner h2 {
        font-size: 24px;
    }

    .welcome-banner {
        padding: 20px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .card-badge {
        align-self: flex-start;
    }

    .action-buttons {
        flex-wrap: wrap;
    }
}