/* 现代化激活码管理系统样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header {
    margin-bottom: 30px;
}

.login-header h1 {
    color: #2c3e50;
    font-size: 28px;
    margin-bottom: 10px;
    font-weight: 600;
}

.login-header p {
    color: #7f8c8d;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.login-btn:active {
    transform: translateY(0);
}

/* 管理面板样式 */
.admin-container {
    background: #f8f9fa;
    min-height: 100vh;
}

.admin-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    margin-bottom: 30px;
}

.admin-header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-title {
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.admin-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.dashboard-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 24px;
}

.card-icon.products {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.card-icon.codes {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.card-icon.stats {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.card-content {
    color: #7f8c8d;
    line-height: 1.6;
}

/* 表单样式 */
.form-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f2f6;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

/* 表格样式 */
.table-container {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.table-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #f1f2f6;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* 状态标签 */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.used {
    background: #fee;
    color: #e74c3c;
}

.status-badge.unused {
    background: #efe;
    color: #27ae60;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .admin-header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-content {
        padding: 0 15px;
    }

    .result-header {
        flex-direction: column;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar select,
    .filter-bar input {
        width: 100%;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 消息提示 */
.message {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.stat-card.unused { border-left: 4px solid #27ae60; }
.stat-card.used { border-left: 4px solid #e74c3c; }
.stat-card.products { border-left: 4px solid #667eea; }

.stat-label {
    color: #7f8c8d;
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
}

/* 生成结果面板 */
.generate-result {
    background: #f0f7ff;
    border: 2px solid #667eea;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 24px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.result-header h3 {
    color: #2c3e50;
    margin-bottom: 6px;
}

.result-meta {
    color: #5d6d7e;
    font-size: 14px;
}

.result-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.result-textarea {
    width: 100%;
    min-height: 120px;
    max-height: 320px;
    padding: 12px;
    border: 1px solid #d6dce3;
    border-radius: 8px;
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: white;
    margin-bottom: 12px;
}

.result-code-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.result-code-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 8px 10px;
}

.result-code-item code {
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    word-break: break-all;
}

.result-hint {
    color: #5d6d7e;
    font-size: 14px;
    margin-top: 4px;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-bar {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eef1f4;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar select,
.filter-bar input {
    padding: 8px 12px;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    min-width: 140px;
}

.filter-bar input {
    flex: 1;
    min-width: 180px;
}

.tool-btn {
    padding: 8px 14px;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    background: white;
    color: #2c3e50;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: #f1f3f5;
}

.tool-btn.primary {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.tool-btn.primary:hover {
    background: #5a6fd6;
}

.copy-btn {
    padding: 4px 10px;
    border: 1px solid #667eea;
    border-radius: 6px;
    background: white;
    color: #667eea;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.copy-btn:hover {
    background: #667eea;
    color: white;
}

.table-scroll {
    overflow-x: auto;
}

.code-cell {
    background: #f1f2f6;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
}

.product-name {
    font-weight: 600;
    color: #2c3e50;
}

.row-unused {
    background: #fbfffb;
}

.row-used {
    opacity: 0.85;
}

.row-new {
    animation: highlightNew 2s ease;
    background: #fff9e6 !important;
}

@keyframes highlightNew {
    0% { background: #ffeaa7; }
    100% { background: #fff9e6; }
}

.empty-row {
    text-align: center;
    color: #999;
    padding: 24px !important;
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
