:root {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #5b21b6;
    --accent: #ec4899;
    --accent-light: #f472b6;
    --bg-dark: #0f0a1a;
    --bg-card: #1a1128;
    --bg-card-hover: #241838;
    --text-primary: #f3f0ff;
    --text-secondary: #a78bfa;
    --text-muted: #6d5a8a;
    --border: #2d1f42;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(124, 58, 237, 0.15);
    --gradient: linear-gradient(135deg, #7c3aed, #ec4899);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; transition: color 0.3s; }
a:hover { color: var(--accent-light); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.navbar {
    background: rgba(15, 10, 26, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 20px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { color: var(--text-secondary); font-size: 14px; padding: 8px 0; transition: color 0.3s; }
.nav-links a:hover { color: var(--text-primary); }

.nav-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 24px; cursor: pointer; }

.hero {
    padding: 80px 20px;
    text-align: center;
    background: radial-gradient(ellipse at center top, rgba(124, 58, 237, 0.15) 0%, transparent 60%);
}

.hero-content { max-width: 600px; margin: 0 auto; }
.hero h1 { font-size: 42px; font-weight: 800; margin-bottom: 16px; line-height: 1.2; }

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p { font-size: 18px; color: var(--text-secondary); margin-bottom: 32px; }

.btn-primary {
    display: inline-block;
    padding: 12px 32px;
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.4);
    color: #fff;
}

.btn-full { width: 100%; text-align: center; }

.section { padding: 60px 20px; max-width: 1200px; margin: 0 auto; }
.section-title { font-size: 28px; margin-bottom: 32px; text-align: center; }

.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.role-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: transform 0.2s, border-color 0.3s, background 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.role-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    background: var(--bg-card-hover);
    color: inherit;
}

.role-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 12px;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
}

.role-avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.avatar-placeholder.female { background: linear-gradient(135deg, #ec4899, #f472b6); }
.avatar-placeholder.male { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.avatar-placeholder.unknown { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }

.role-info h3 { font-size: 16px; margin-bottom: 4px; color: var(--text-primary); }
.role-info p { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.4; }

.role-tag {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(124, 58, 237, 0.15);
    color: var(--primary-light);
    border-radius: 20px;
    font-size: 12px;
    margin-right: 8px;
}

.role-stat { font-size: 12px; color: var(--text-muted); }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    transition: transform 0.2s;
}

.feature-card:hover { transform: translateY(-4px); }
.feature-icon { font-size: 40px; margin-bottom: 16px; }
.feature-card h3 { font-size: 18px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-muted); }

.login-page { display: flex; justify-content: center; padding: 60px 20px; min-height: calc(100vh - 64px - 80px); align-items: center; }

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 420px;
    max-width: 100%;
}

.login-card h2 { text-align: center; margin-bottom: 8px; font-size: 24px; }
.login-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 32px; font-size: 14px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--primary); }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }
.form-group textarea { min-height: 100px; resize: vertical; }

.code-row { display: flex; gap: 10px; }
.code-row input { flex: 1; }

.btn-send-code {
    padding: 10px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
    transition: background 0.3s;
}

.btn-send-code:hover { background: var(--primary-dark); }
.btn-send-code:disabled { background: var(--text-muted); cursor: not-allowed; }

.error-msg { color: var(--danger); font-size: 13px; margin-bottom: 16px; }

.page-title { font-size: 28px; margin-bottom: 24px; text-align: center; }

.roles-page { max-width: 1200px; margin: 0 auto; padding: 30px 20px; }

.roles-toolbar { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; align-items: center; }

.category-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.category-tabs .tab {
    padding: 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.category-tabs .tab.active,
.category-tabs .tab:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.search-box input {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    width: 240px;
}

.search-box input:focus { border-color: var(--primary); }

.pagination { display: flex; gap: 6px; margin-top: 24px; justify-content: center; }
.pagination a {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
}

.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.profile-page { max-width: 1000px; margin: 0 auto; padding: 30px 20px; }

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 40px; }

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.profile-avatar { text-align: center; margin-bottom: 16px; }
.profile-avatar img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }

.avatar-placeholder.large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    background: var(--gradient);
}

.profile-info { text-align: center; margin-bottom: 20px; }
.profile-info h2 { font-size: 20px; margin-bottom: 4px; }
.profile-info p { font-size: 13px; color: var(--text-muted); }

.info-cards { display: flex; flex-direction: column; gap: 16px; }

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}

.info-icon { font-size: 32px; margin-bottom: 8px; }
.info-value { font-size: 24px; font-weight: 700; color: var(--primary-light); margin-bottom: 4px; }
.info-label { font-size: 13px; color: var(--text-muted); }

.profile-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.profile-section h2 { font-size: 18px; margin-bottom: 16px; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table th { color: var(--text-muted); font-weight: 500; }

.create-role-page { max-width: 700px; margin: 0 auto; padding: 30px 20px; }

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.form-section h3 { font-size: 18px; margin-bottom: 20px; color: var(--primary-light); }

.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.empty { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }

.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 24px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

@media (max-width: 768px) {
    .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; background: rgba(15, 10, 26, 0.98); flex-direction: column; padding: 20px; gap: 12px; border-bottom: 1px solid var(--border); }
    .nav-links.show { display: flex; }
    .nav-toggle { display: block; }
    .hero h1 { font-size: 28px; }
    .hero p { font-size: 15px; }
    .profile-grid { grid-template-columns: 1fr; }
    .role-grid { grid-template-columns: 1fr; }
    .roles-toolbar { flex-direction: column; }
    .search-box input { width: 100%; }
}
