/* Mess&Anger Admin Panel - Styles */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --border: #475569;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Login Screen */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .logo {
    font-size: 2rem;
    margin-bottom: 8px;
}

.login-header .badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-block {
    width: 100%;
}

.login-error {
    margin-top: 16px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    color: var(--danger);
    font-size: 0.875rem;
    text-align: center;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.login-footer code {
    display: block;
    margin-top: 8px;
    padding: 8px 16px;
    background: var(--bg-dark);
    border-radius: var(--radius);
    font-family: monospace;
}

/* Privacy Banner */
.privacy-banner {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), rgba(16, 185, 129, 0.1));
    border-bottom: 1px solid var(--primary);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.privacy-banner.show {
    display: flex;
}

.privacy-icon {
    width: 20px;
    height: 20px;
    color: var(--success);
    flex-shrink: 0;
}

.privacy-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

.privacy-close:hover {
    color: var(--text-primary);
}

/* Role Badge */
.role-badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Role Cards */
.role-description {
    margin-bottom: 24px;
}

.role-description h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.role-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.role-card h4 {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.role-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.role-permissions {
    display: block;
    font-size: 0.625rem;
    color: var(--primary-light);
    font-family: monospace;
    word-break: break-all;
}

/* Admin Container */
.admin-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
    min-height: 100vh;
}

/* Header */
.admin-header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo span {
    color: var(--primary);
}

.badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
}

.status-indicator.online {
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-weight: 500;
}

/* Sidebar */
.admin-sidebar {
    grid-area: sidebar;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
}

/* Main Content */
.admin-main {
    grid-area: main;
    padding: 24px;
    overflow-y: auto;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

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

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.text-danger {
    color: var(--danger);
}

.text-muted {
    color: var(--text-muted);
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-card);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.625rem;
    font-weight: 500;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    gap: 16px;
    border: 1px solid var(--border);
}

.stat-card.warning {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.stat-card.danger {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.users { background: rgba(59, 130, 246, 0.2); color: var(--info); }
.stat-icon.messages { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.stat-icon.stars { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.stat-icon.revenue { background: rgba(99, 102, 241, 0.2); color: var(--primary); }
.stat-icon.ads { background: rgba(236, 72, 153, 0.2); color: #ec4899; }
.stat-icon.views { background: rgba(59, 130, 246, 0.2); color: var(--info); }
.stat-icon.clicks { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.stat-icon.ctr { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.stat-icon.premium { background: rgba(99, 102, 241, 0.2); color: var(--primary); }
.stat-icon.revenue-stars { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.stat-icon.reports { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.stat-icon.blocked { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.stat-icon.spam { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 4px;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }
.stat-change.neutral { color: var(--text-muted); }

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.chart-container {
    height: 250px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-hover);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.empty-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 40px !important;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group .hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.search-input {
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    width: 250px;
}

.select {
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    cursor: pointer;
}

/* Config Form */
.config-form {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    max-width: 500px;
}

/* Settings */
.settings-groups {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-group {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
}

.settings-group h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.settings-group.danger-zone {
    border-color: var(--danger);
}

.settings-group.danger-zone h3 {
    color: var(--danger);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    position: relative;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Activity */
.activity-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
}

.activity-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-dark);
    border-radius: var(--radius);
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon svg {
    width: 16px;
    height: 16px;
}

.activity-icon.info { background: rgba(59, 130, 246, 0.2); color: var(--info); }
.activity-icon.success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.activity-icon.warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.activity-icon.danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

.activity-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-title {
    font-size: 0.875rem;
    font-weight: 500;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Security */
.security-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.security-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.security-stat.success .stat-number { color: var(--success); }
.security-stat.danger .stat-number { color: var(--danger); }
.security-stat.warning .stat-number { color: var(--warning); }

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
}

.logs-list {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.log-item {
    display: grid;
    grid-template-columns: 180px 150px 150px 100px 1fr;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.log-item:last-child {
    border-bottom: none;
}

.log-item.header {
    background: var(--bg-hover);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.log-item.empty {
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

.severity-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-badge.low { background: var(--info); color: white; }
.severity-badge.medium { background: var(--warning); color: black; }
.severity-badge.high { background: var(--danger); color: white; }
.severity-badge.critical { background: #dc2626; color: white; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 20px;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.page-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Stars Config */
.stars-config,
.top-users {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.stars-config h3,
.top-users h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
    .admin-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }
    
    .admin-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .header-actions {
        flex-wrap: wrap;
    }
    
    .search-input {
        width: 100%;
    }
}
