@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --bg-primary: #080916;
    --bg-gradient: radial-gradient(circle at 50% 50%, #12132a 0%, #06070e 100%);
    --card-bg: rgba(20, 22, 45, 0.45);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-border-glow: rgba(138, 92, 246, 0.2);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-telegram: #229ED9;
    --accent-ton: #0088CC;
    --accent-primary: #8b5cf6;
    --accent-secondary: #06b6d4;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-header: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* Glassmorphism Containers */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: var(--card-border-glow);
    box-shadow: 0 8px 32px 0 rgba(139, 92, 246, 0.1);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-header);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-primary) 70%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Layout Elements */
.auth-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
}

/* Glow Background Orbs */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.2;
}
.orb-1 {
    width: 300px;
    height: 300px;
    background: var(--accent-primary);
    top: 15%;
    left: 20%;
}
.orb-2 {
    width: 250px;
    height: 250px;
    background: var(--accent-secondary);
    bottom: 15%;
    right: 20%;
}

/* Auth Card */
.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    text-align: center;
}

.logo-container {
    margin-bottom: 24px;
}

.logo-icon {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    display: inline-block;
    filter: drop-shadow(0 4px 10px rgba(139, 92, 246, 0.3));
}

.auth-card h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

/* Buttons & Interactive Elements */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-family: var(--font-body);
    font-weight: 550;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: #ffffff;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: skewX(-25deg);
    transition: 0.75s;
    opacity: 0;
}

.btn:hover::after {
    left: 125%;
    opacity: 1;
}

.btn:active {
    transform: scale(0.98);
}

.btn-telegram {
    background: var(--accent-telegram);
    box-shadow: 0 4px 15px rgba(34, 158, 217, 0.3);
}
.btn-telegram:hover {
    background: #2cb2f2;
    box-shadow: 0 6px 20px rgba(34, 158, 217, 0.4);
}

.btn-ton {
    background: #0098ea;
    box-shadow: 0 4px 15px rgba(0, 152, 234, 0.3);
}
.btn-ton:hover {
    background: #1cb0ff;
    box-shadow: 0 6px 20px rgba(0, 152, 234, 0.4);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}
.btn-primary:hover {
    opacity: 0.95;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 24px 0;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.divider:not(:empty)::before {
    margin-right: 12px;
}
.divider:not(:empty)::after {
    margin-left: 12px;
}

/* User Card inside Login (State when authenticated) */
.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 1.1rem;
}

.user-info-text {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navigation Bar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(8, 9, 22, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-brand {
    font-family: var(--font-header);
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-logout {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
    text-decoration: none;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    transition: var(--transition-smooth);
}
.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Admin Dashboard Layout */
.dashboard-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 24px;
    width: 100%;
    flex: 1;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.dashboard-title h2 {
    font-size: 2rem;
    margin-bottom: 6px;
}

.dashboard-title p {
    color: var(--text-secondary);
}

/* Search Box */
.search-container {
    position: relative;
    width: 100%;
    max-width: 320px;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    padding-left: 40px;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

/* Main Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 960px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.section-card {
    padding: 24px;
    margin-bottom: 24px;
}

.section-card h3 {
    margin-bottom: 20px;
    font-size: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Users Table */
.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 14px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.95rem;
}

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

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Badge/Pill Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-viewer {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-secondary);
}

.badge-admin {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-primary);
}

.badge-sa {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-select, .form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 14px;
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-select:focus, .form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-select option {
    background: #0e101f;
    color: var(--text-primary);
}

/* Permission List Item */
.permission-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.btn-delete-icon {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-delete-icon:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 0;
    font-size: 0.95rem;
}
