/* ============================================
   接码平台 - 主样式表
   设计风格：深色侧边栏 + 浅色内容区
   色彩：靛蓝 #4f46e5 / 深灰 #1e293b
   ============================================ */

:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #818cf8;
    --bg-dark: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-light: #f8fafc;
    --bg-card: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --text-light: #cbd5e1;
    --border: #e2e8f0;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

/* ========== 全局样式 ========== */
* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
}

a { text-decoration: none; color: var(--primary); }

/* ========== 渐变背景 ========== */
.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== 卡片 ========== */
.card-modern {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.card-modern .card-header {
    background: var(--bg-dark);
    color: white;
    padding: 16px 24px;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-modern .card-body {
    padding: 24px;
}

/* ========== 输入框 ========== */
.input-modern {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    background: #fff;
}

.input-modern:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* ========== 按钮 ========== */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary-modern:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-success-modern:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

.btn-outline-modern {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

/* ========== 兑换页面 ========== */
.redeem-container {
    max-width: 420px;
    width: 100%;
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

.redeem-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.redeem-card .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.redeem-card .subtitle {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.balance-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0fdf4;
    color: var(--success);
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
}

.alert-modern {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.alert-modern.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-modern.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ========== 项目选择页 ========== */
.project-grid {
    display: grid;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.project-item {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

.project-item .name {
    font-weight: 600;
    font-size: 1.05rem;
}

.project-item .channel-tag {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 2px 10px;
    border-radius: 12px;
}

.price-tag {
    background: var(--primary);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
}

/* ========== 验证码查看页 ========== */
.sms-bg {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sms-card {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 48px 40px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    border: 1px solid rgba(255,255,255,0.1);
    animation: fadeIn 0.5s ease;
}

.sms-card .phone-number {
    color: rgba(255,255,255,0.5);
    font-size: 1rem;
    margin-bottom: 32px;
}

.sms-card .phone-number strong {
    color: rgba(255,255,255,0.9);
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
}

.waiting-indicator {
    padding: 40px 0;
}

.spinner-ring {
    display: inline-block;
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.waiting-indicator .label {
    color: rgba(255,255,255,0.6);
    font-size: 1.1rem;
    margin-top: 20px;
}

.waiting-indicator .hint {
    color: rgba(255,255,255,0.3);
    font-size: 0.85rem;
    margin-top: 8px;
}

.code-display {
    font-size: 4rem;
    font-weight: 800;
    color: var(--success);
    letter-spacing: 8px;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 40px rgba(34,197,94,0.3);
    animation: codePulse 2s ease-in-out;
}

.sms-body {
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 24px;
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
}

/* ========== 后台管理 ========== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--bg-sidebar);
    color: white;
    padding: 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.sidebar-nav {
    padding: 12px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.6);
    transition: all 0.2s;
    font-size: 0.95rem;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.08);
    color: white;
}

.sidebar-nav hr {
    border-color: rgba(255,255,255,0.1);
    margin: 12px 20px;
}

.sidebar-nav .text-danger {
    color: var(--danger) !important;
}

.main-content {
    flex: 1;
    padding: 32px;
    max-width: 1200px;
}

.main-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

/* ========== 统计卡片 ========== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-card .value {
    font-size: 1.8rem;
    font-weight: 700;
}

/* ========== 表格 ========== */
.table-modern {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-modern th {
    background: var(--bg-dark);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-modern td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.table-modern tr:last-child td { border-bottom: none; }

.table-modern tr:hover td { background: #f8fafc; }

/* ========== 弹窗 ========== */
.modal-modern {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal-modern .modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-modern .modal-header {
    background: var(--bg-dark);
    color: white;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 16px 24px;
}

.modal-modern .modal-body {
    padding: 24px;
}

.modal-modern .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ========== 卡片生成区域 ========== */
.card-generator {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.code-list-area {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    width: 100%;
    min-height: 120px;
    border: none;
    resize: vertical;
}

/* ========== 动画 ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes codePulse {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes breathe {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.breathe {
    animation: breathe 2s ease-in-out infinite;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
    }
    .admin-layout { flex-direction: column; }
    .main-content { padding: 20px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .code-display { font-size: 2.5rem; letter-spacing: 4px; }
    .redeem-card { padding: 28px 20px; }
    .sms-card { padding: 32px 20px; margin: 16px; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .project-item { flex-direction: column; align-items: flex-start; gap: 8px; }
}