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

/* Light theme (default) */
:root {
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --card-bg: white;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #eee;
    --input-bg: white;
    --input-border: #ddd;
    --table-header-bg: #f5f5f5;
    --table-row-hover: #f9f9f9;
}

/* Dark theme */
.dark-theme {
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --card-bg: #0f0f1a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: #2a2a3e;
    --input-bg: #1a1a2e;
    --input-border: #2a2a3e;
    --table-header-bg: #1a1a2e;
    --table-row-hover: #1a1a2e;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 20px;
    transition: background 0.3s ease;
}

.container {
    text-align: center;
    animation: fadeIn 0.8s ease-out;
    width: 100%;
    max-width: 1200px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    transition: background 0.3s ease;
}

/* For users page - wider card */
.card-wide {
    max-width: 1200px;
    width: 95%;
    padding: 40px;
}

h1 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 2.5em;
}

.twitch-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
}

p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1em;
}

.twitch-btn {
    background: #9146FF;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
}

.twitch-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(145, 70, 255, 0.4);
    background: #7a3bdb;
}

.twitch-btn:active {
    transform: translateY(0);
}

.twitch-icon {
    width: 24px;
    height: 24px;
    fill: white;
}

.features {
    margin-top: 30px;
    text-align: left;
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.feature:before {
    content: "✓";
    color: #9146FF;
    font-weight: bold;
    font-size: 1.2em;
}

/* Theme toggle button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    color: white;
}

.theme-toggle:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Users page styles */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.logout-btn {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid #dc3545;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.logout-btn:hover {
    background: #dc3545;
    color: white;
    transform: translateY(-1px);
}

.section {
    margin-bottom: 40px;
    border-top: 2px solid var(--border-color);
    padding-top: 30px;
}

.section h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.8em;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #9146FF;
}

.submit-btn {
    background: #9146FF;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
    width: 100%;
}

.submit-btn:hover {
    background: #7a3bdb;
    transform: translateY(-1px);
}

/* Invite form in one line */
.invite-form-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.invite-input-group {
    flex: 2;
    min-width: 180px;
}

.invite-select-group {
    flex: 1;
    min-width: 150px;
}

.invite-form-inline .submit-btn {
    flex-shrink: 0;
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
}

.invite-form-inline input,
.invite-form-inline select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.2s;
}

.invite-form-inline input:focus,
.invite-form-inline select:focus {
    outline: none;
    border-color: #9146FF;
    box-shadow: 0 0 0 3px rgba(145, 70, 255, 0.1);
}

/* Section header with filters */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    margin-bottom: 0;
}

.filter-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    min-width: 200px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
}

.filter-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #9146FF;
}

/* Table wrapper for responsive */
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

th {
    background: var(--table-header-bg);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background: var(--table-row-hover);
}

.username-cell {
    font-weight: 500;
}

/* Role cell and select dropdown */
.role-cell {
    min-width: 200px;
}

.role-select {
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.role-select:focus {
    outline: none;
    border-color: #9146FF;
    box-shadow: 0 0 0 2px rgba(145, 70, 255, 0.2);
}

.role-select:hover:not(:disabled) {
    border-color: #9146FF;
}

.role-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--table-header-bg);
}

.role-select option {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 8px;
}

/* Dark theme specific select styling */
.dark-theme .role-select {
    background: #1a1a2e;
    border-color: #2a2a3e;
}

.dark-theme .role-select option {
    background: #1a1a2e;
}

/* Role badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.role-superadmin {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.role-admin {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.role-moderator {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #333;
}

.role-user {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}

/* Modern status switch (toggle button) */
.status-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 26px;
    background: #c0c0c0;
    border-radius: 30px;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    padding: 0;
}

.status-switch.active {
    background: #9146FF;
}

.status-switch.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.status-switch-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.status-switch.active .status-switch-slider {
    transform: translateX(26px);
}

/* Delete button */
.delete-btn {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid #dc3545;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.delete-btn:hover:not(:disabled) {
    background: #dc3545;
    color: white;
    transform: translateY(-1px);
}

.delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Empty row */
.empty-row td {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .card-wide {
        padding: 20px;
    }

    .theme-toggle {
        position: static;
        margin-bottom: 20px;
    }

    .header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .invite-form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .invite-form-inline .submit-btn {
        width: 100%;
        justify-content: center;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        justify-content: space-between;
    }

    th, td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .role-cell {
        min-width: 160px;
    }

    .role-select {
        font-size: 11px;
        padding: 4px 8px;
    }
}