/* 后台管理页面样式 */
:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --primary-color: #6366f1;
    --success-color: #10b981;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
}

.login-container h1 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group label input[type="radio"] {
    width: auto;
    margin-right: 0.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
}

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

.error-message {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    min-height: 1.2rem;
}

.success-message {
    color: var(--success-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.admin-page {
    min-height: 100vh;
    background: var(--bg-color);
    padding: 2rem;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
}

.admin-header {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-header h1 {
    color: var(--text-primary);
    margin: 0;
}

.admin-actions {
    display: flex;
    gap: 1rem;
}

.admin-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.admin-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.admin-section h2.section-title {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 0.5rem;
    margin: -0.5rem -0.5rem 1.5rem -0.5rem;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.admin-section h2.section-title:hover {
    background-color: #f1f5f9;
}

.section-arrow {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.admin-section.collapsed .section-arrow {
    transform: rotate(-90deg);
}

.section-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 5000px;
    opacity: 1;
}

.admin-section.collapsed .section-content {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    padding: 0;
}

.card-generator {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.result-box {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.generated-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.card-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-family: monospace;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-item code {
    color: var(--primary-color);
    font-weight: 600;
}

.copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: #4f46e5;
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.date-group {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.date-group-header {
    background: var(--bg-color);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.3s ease;
}

.date-group-header:hover {
    background: #f1f5f9;
}

.date-group-title {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-group-actions {
    display: flex;
    gap: 0.5rem;
}

.date-group-content {
    display: none;
    padding: 1.5rem;
}

.date-group.expanded .date-group-content {
    display: block;
}

.cards-table {
    width: 100%;
    border-collapse: collapse;
}

.cards-table th,
.cards-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.cards-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.cards-table td {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.card-code {
    font-family: monospace;
    font-weight: 600;
    color: var(--primary-color);
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-unused {
    background: #dbeafe;
    color: #1e40af;
}

.status-used {
    background: #d1fae5;
    color: #065f46;
}

.status-expired {
    background: #fee2e2;
    color: #991b1b;
}

.action-btn {
    padding: 0.25rem 0.75rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-expire {
    background: #fee2e2;
    color: #991b1b;
}

.btn-expire:hover {
    background: #fecaca;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #4f46e5;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* 接口管理样式 */
.api-keys-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: flex-end;
}

.api-keys-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.api-key-item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.api-key-info {
    flex: 1;
}

.api-key-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.api-key-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.api-key-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.api-key-actions {
    display: flex;
    gap: 0.5rem;
}

.api-key-value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-color);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.api-key-value code {
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
    letter-spacing: 0.05em;
    user-select: all;
    font-size: 0.9rem;
    color: var(--primary-color);
    flex: 1;
    word-break: break-all;
}

.status-active {
    color: var(--success-color);
    font-weight: 600;
}

.status-disabled {
    color: #ef4444;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .cards-table {
        font-size: 0.8rem;
    }

    .cards-table th,
    .cards-table td {
        padding: 0.5rem;
    }

    .api-key-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

