/* 多应用授权系统 - 通用样式 */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    box-shadow: var(--shadow);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.site-logo { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.site-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-nav a { color: var(--muted); font-size: .95rem; }
.site-nav a:hover, .site-nav a.active { color: var(--primary); text-decoration: none; }

/* Layout */
.page-title { font-size: 1.5rem; margin: 24px 0 16px; }
.main-content { padding: 24px 0 48px; }

/* Card */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--muted); font-size: .9rem; margin-top: 4px; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: .9rem; }
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .95rem;
    transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input { width: auto; }
.form-text { font-size: .85rem; color: var(--muted); margin-top: 4px; }

/* Button */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: .95rem;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f1f5f9; font-weight: 600; white-space: nowrap; }
tr:hover { background: #f8fafc; }

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Pagination */
.pagination { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
}
.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Admin sidebar layout */
.admin-layout { display: flex; min-height: calc(100vh - 60px); }
.admin-sidebar {
    width: 220px;
    background: #1e293b;
    color: #fff;
    flex-shrink: 0;
}
.admin-sidebar nav { padding: 16px 0; }
.admin-sidebar a {
    display: block;
    padding: 10px 20px;
    color: #94a3b8;
    font-size: .9rem;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
    background: rgba(255,255,255,.08);
    color: #fff;
    text-decoration: none;
}
.admin-main { flex: 1; padding: 24px; overflow-x: auto; }

/* Login */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
    background: var(--card);
    padding: 32px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,.15);
}
.login-box h1 { text-align: center; margin-bottom: 24px; font-size: 1.5rem; }

/* Frontend hero */
.hero {
    text-align: center;
    padding: 48px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: var(--radius);
    margin-bottom: 24px;
}
.hero h1 { font-size: 2rem; margin-bottom: 12px; }
.hero p { opacity: .9; max-width: 600px; margin: 0 auto; }

/* Code display */
.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    font-family: monospace;
    font-size: .85rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 16px;
    padding: 16px;
    background: #f1f5f9;
    border-radius: var(--radius);
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }

/* Mobile */
@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; }
    .admin-sidebar nav { display: flex; flex-wrap: wrap; padding: 8px; }
    .admin-sidebar a { padding: 8px 12px; }
    .hero h1 { font-size: 1.5rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}
