* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
}

/* Auth page */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    position: relative;
    overflow: hidden;
}
.auth-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79,70,229,0.3) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    animation: float 8s ease-in-out infinite;
}
.auth-wrapper::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16,185,129,0.2) 0%, transparent 70%);
    bottom: -100px;
    left: -50px;
    animation: float 6s ease-in-out infinite reverse;
}
@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}
.auth-box {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    padding: 40px;
    width: 400px;
    max-width: 90vw;
    position: relative;
    z-index: 1;
}
.auth-box h1 {
    text-align: center;
    margin-bottom: 24px;
    color: #f0f0f0;
    font-size: 24px;
    letter-spacing: 2px;
}
.tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
}
.tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
    transition: all 0.2s;
}
.tab.active {
    color: #818cf8;
    border-bottom: 2px solid #818cf8;
    margin-bottom: -2px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
}
.auth-box input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    color: #f0f0f0;
    transition: border-color 0.2s, background 0.2s;
}
.auth-box input:focus {
    border-color: #818cf8;
    background: rgba(255,255,255,0.12);
}
.auth-box input::placeholder { color: rgba(255,255,255,0.3); }
input, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
input:focus, select:focus { border-color: #4f46e5; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn:hover { background: #4338ca; }
.auth-box .btn-block {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 10px;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(99,102,241,0.4);
}
.auth-box .btn-block:hover {
    background: linear-gradient(135deg, #818cf8, #a78bfa);
    box-shadow: 0 6px 20px rgba(99,102,241,0.5);
    transform: translateY(-1px);
}
.btn-block { width: 100%; padding: 12px; font-size: 16px; }
.btn-danger { background: #ef4444; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #10b981; }
.btn-success:hover { background: #059669; }
.btn-warning { background: #f59e0b; }
.btn-warning:hover { background: #d97706; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Messages */
.message {
    margin-top: 16px;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}
.auth-box .message.success { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.auth-box .message.error { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.message.success { background: #ecfdf5; color: #065f46; }
.message.error { background: #fef2f2; color: #991b1b; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    background: #1f2937;
    color: #fff;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #374151;
    font-size: 18px;
    font-weight: 600;
}
.sidebar-menu { list-style: none; padding: 12px 0; flex: 1; }
.sidebar-menu li {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-menu li:hover { background: #374151; }
.sidebar-menu li.active { background: #4f46e5; }
.sidebar-menu li .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-menu .menu-group { margin: 0; }
.sidebar-menu .menu-parent {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}
.sidebar-menu .menu-parent:hover { background: #374151; }
.sidebar-menu .menu-parent .left { display: flex; align-items: center; gap: 10px; }
.sidebar-menu .menu-parent .arrow {
    font-size: 10px;
    transition: transform 0.2s;
}
.sidebar-menu .menu-parent.open .arrow { transform: rotate(90deg); }
.sidebar-menu .submenu {
    display: none;
    list-style: none;
    background: #111827;
}
.sidebar-menu .submenu.show { display: block; }
.sidebar-menu .submenu li {
    padding: 10px 20px 10px 52px;
    font-size: 13px;
}
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.sidebar-footer .user-info { color: #9ca3af; }
.sidebar-footer .logout-link {
    color: #ef4444;
    cursor: pointer;
    font-size: 12px;
}
.sidebar-footer .logout-link:hover { text-decoration: underline; }

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 24px;
    gap: 12px;
}
.user-dropdown {
    position: relative;
    display: inline-block;
}
.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: box-shadow 0.2s;
}
.user-dropdown-btn:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.user-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 42px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    min-width: 140px;
    z-index: 100;
    overflow: hidden;
}
.user-dropdown-menu.show { display: block; }
.user-dropdown-menu a {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}
.user-dropdown-menu a:hover { background: #f3f4f6; }
.user-dropdown-menu a.danger { color: #ef4444; }
.page-header { margin-bottom: 24px; }
.page-header h2 {
    font-size: 22px;
    color: #1f2937;
    margin-bottom: 6px;
}
.page-header p {
    color: #6b7280;
    font-size: 14px;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    padding: 24px;
    margin-bottom: 20px;
}
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    text-align: center;
}
.stat-card .number {
    font-size: 32px;
    font-weight: 700;
    color: #4f46e5;
}
.stat-card .label {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

/* Table */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}
th {
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}
tr:hover { background: #f9fafb; }
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
.badge-admin { background: #eef2ff; color: #3730a3; }
.badge-user { background: #ecfdf5; color: #065f46; }
.badge-guest { background: #fef3c7; color: #92400e; }
.badge-enabled { background: #ecfdf5; color: #065f46; }
.badge-disabled { background: #fef2f2; color: #991b1b; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    width: 400px;
    max-width: 90vw;
}
.modal h3 {
    margin-bottom: 20px;
    color: #1f2937;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.search-bar input {
    max-width: 260px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}
.page-info {
    font-size: 13px;
    color: #6b7280;
}
.page-btns {
    display: flex;
    gap: 6px;
}
.page-btns .btn-sm.page-active {
    background: #4f46e5;
    color: #fff;
}
.page-btns .btn-sm.page-num {
    background: #f3f4f6;
    color: #374151;
}
.page-btns .btn-sm.page-num:hover {
    background: #e5e7eb;
}

/* Tag Input */
.tag-input-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-height: 42px;
    align-items: center;
    cursor: text;
    transition: border-color 0.2s;
}
.tag-input-wrap:focus-within { border-color: #4f46e5; }
.tag-input-wrap input {
    border: none;
    outline: none;
    padding: 2px 4px;
    font-size: 14px;
    flex: 1;
    min-width: 100px;
}
.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}
.tag-item .tag-remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: #6366f1;
    margin-left: 2px;
}
.tag-item .tag-remove:hover { color: #ef4444; }
.tag-count {
    font-size: 12px;
    color: #4f46e5;
    font-weight: 600;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}
.checkbox-group label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}
.checkbox-group label:hover { background: #e5e7eb; }
.checkbox-group input[type="checkbox"] { width: auto; margin: 0; }
.checkbox-group input[type="checkbox"]:checked + span {
    color: #4f46e5;
    font-weight: 600;
}
.checkbox-group label:has(input:checked) {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.hidden { display: none; }
