/**
 * TutoScore Admin - Styles WordPress-like
 */

:root {
    /* Couleurs WordPress-inspired */
    --sidebar-bg: #1d2327;
    --sidebar-hover: #2c3338;
    --sidebar-active: #2271b1;
    --sidebar-text: #c3c4c7;
    --sidebar-text-hover: #72aee6;
    --sidebar-width: 260px;
    --sidebar-collapsed: 60px;

    --bg-body: #f0f0f1;
    --bg-card: #ffffff;
    --text-primary: #1d2327;
    --text-secondary: #646970;
    --text-muted: #a7aaad;

    --primary: #2271b1;
    --primary-hover: #135e96;
    --success: #00a32a;
    --warning: #dba617;
    --danger: #d63638;
    --info: #72aee6;

    --border-color: #c3c4c7;
    --border-light: #e0e0e0;

    --radius: 4px;
    --shadow: 0 1px 1px rgba(0,0,0,.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,.1);

    /* Module colors */
    --color-notes: #3b82f6;
    --color-chords: #f59e0b;
    --color-rhythm: #22c55e;
    --color-sightread: #a855f7;
    --color-progressions: #ec4899;
    --color-eartraining: #06b6d4;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width 0.2s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .username,
.sidebar.collapsed .badge {
    display: none;
}

.sidebar.collapsed .logo {
    justify-content: center;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .admin-user {
    justify-content: center;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.logo svg {
    flex-shrink: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.15s;
    position: relative;
}

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

.nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #fff;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.nav-separator {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 12px 16px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.username {
    font-size: 13px;
    color: #fff;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--danger);
    color: #fff;
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    margin-left: var(--sidebar-width);
    padding: 20px;
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* Top Bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.top-bar h1 {
    font-size: 23px;
    font-weight: 400;
    color: var(--text-primary);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.last-update {
    font-size: 12px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

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

.btn-secondary {
    background: #fff;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-body);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ============================================
   STATS CARDS
   ============================================ */

.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: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow);
}

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

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

.stat-icon.users {
    background: rgba(34, 113, 177, 0.1);
    color: var(--primary);
}

.stat-icon.sessions {
    background: rgba(0, 163, 42, 0.1);
    color: var(--success);
}

.stat-icon.time {
    background: rgba(167, 86, 247, 0.1);
    color: #a855f7;
}

.stat-icon.messages {
    background: rgba(219, 166, 23, 0.1);
    color: var(--warning);
}

.stat-info {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

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

.stat-trend {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.stat-trend.up {
    color: var(--success);
}

.stat-trend.down {
    color: var(--danger);
}

/* ============================================
   CHARTS
   ============================================ */

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

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

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

.chart-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text-primary);
}

.chart-container {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-placeholder {
    color: var(--text-muted);
    font-size: 13px;
}

/* Simple bar chart */
.bar-chart {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding-bottom: 24px;
}

.bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.bar {
    width: 100%;
    max-width: 40px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
    transition: height 0.3s ease;
}

.bar-label {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Module chart */
.module-chart {
    width: 100%;
}

.module-bar {
    margin-bottom: 12px;
}

.module-bar-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 12px;
}

.module-bar-name {
    color: var(--text-primary);
}

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

.module-bar-track {
    height: 8px;
    background: var(--bg-body);
    border-radius: 4px;
    overflow: hidden;
}

.module-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.module-bar-fill.notes { background: var(--color-notes); }
.module-bar-fill.chords { background: var(--color-chords); }
.module-bar-fill.rhythm { background: var(--color-rhythm); }
.module-bar-fill.sightread { background: var(--color-sightread); }
.module-bar-fill.progressions { background: var(--color-progressions); }
.module-bar-fill.eartraining { background: var(--color-eartraining); }

/* ============================================
   TABLES
   ============================================ */

.tables-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
}

.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: visible;
}

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

.table-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.table-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.view-all {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
}

.view-all:hover {
    text-decoration: underline;
}

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

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

.admin-table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-body);
}

.admin-table td {
    font-size: 13px;
    color: var(--text-primary);
}

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

.admin-table tr:hover td {
    background: var(--bg-body);
}

.admin-table .loading {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 3px;
}

.status-badge.active {
    background: rgba(0, 163, 42, 0.1);
    color: var(--success);
}

.status-badge.inactive {
    background: rgba(100, 105, 112, 0.1);
    color: var(--text-secondary);
}

.status-badge.banned {
    background: rgba(214, 54, 56, 0.1);
    color: var(--danger);
}

.status-badge.warning {
    background: rgba(219, 166, 23, 0.1);
    color: #996800;
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

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

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

.form-group input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.form-error {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 16px;
    min-height: 20px;
}

/* ============================================
   TOAST
   ============================================ */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--text-primary);
    color: #fff;
    border-radius: var(--radius);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 782px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar.collapsed + .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .tables-row {
        grid-template-columns: 1fr;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
    }
}

/* ============================================
   USERS PAGE SPECIFIC
   ============================================ */

/* Search box */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.search-box input {
    border: none;
    outline: none;
    font-size: 13px;
    width: 200px;
}

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

.filter-select {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: #fff;
}

/* Small stats grid */
.stats-grid-small {
    grid-template-columns: repeat(4, 1fr);
}

.stat-card-small {
    padding: 16px;
    text-align: center;
}

.stat-card-small .stat-value {
    font-size: 24px;
}

/* DeepL quota card */
.stat-deepl {
    position: relative;
}

.stat-deepl .stat-info {
    margin-bottom: 8px;
}

.deepl-progress {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.deepl-bar {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.5s ease, background 0.3s;
}

.deepl-detail {
    font-size: 11px;
    color: var(--text-muted);
}

.stat-deepl.warning {
    border-color: var(--danger);
}

.stat-deepl.warning .stat-value {
    color: var(--danger);
}

/* Table responsive */
.table-responsive {
    overflow: visible;
}

/* Sortable columns */
.sortable {
    cursor: pointer;
    user-select: none;
}

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

.sortable::after {
    content: '';
    display: inline-block;
    margin-left: 4px;
    width: 0;
    height: 0;
    vertical-align: middle;
}

.sortable.sort-asc::after {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid currentColor;
}

.sortable.sort-desc::after {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
}

/* Role badge */
.role-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 3px;
}

.role-badge.role-user {
    background: rgba(100, 105, 112, 0.1);
    color: var(--text-secondary);
}

.role-badge.role-admin {
    background: rgba(34, 113, 177, 0.1);
    color: var(--primary);
}

/* User email link */
.user-email-link {
    color: var(--primary);
    text-decoration: none;
}

.user-email-link:hover {
    text-decoration: underline;
}

/* Actions cell */
.actions-cell {
    position: relative;
    white-space: nowrap;
}

.btn-icon {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius);
    transition: all 0.15s;
}

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

/* Dropdown menu - s'ouvre à gauche du bouton */
.dropdown-menu {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    z-index: 1000;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a,
.dropdown-menu span {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s;
}

.dropdown-menu a:hover {
    background: var(--bg-body);
}

.dropdown-menu a.danger {
    color: var(--danger);
}

.dropdown-menu span.disabled {
    color: var(--text-muted);
    font-style: italic;
}

/* Table footer / pagination */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    gap: 4px;
}

.pagination-btn {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.pagination-btn:hover:not([disabled]) {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-dots {
    padding: 6px 8px;
    color: var(--text-muted);
}

/* Modal large */
.modal-large {
    max-width: 600px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    gap: 12px;
}

.modal-actions-left {
    display: flex;
    gap: 8px;
}

.modal-actions-right {
    display: flex;
    gap: 8px;
}

/* User detail grid */
.user-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.user-detail-section h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
}

.detail-list dt {
    font-size: 13px;
    color: var(--text-muted);
}

.detail-list dd {
    font-size: 13px;
    color: var(--text-primary);
    margin: 0;
}

@media (max-width: 600px) {
    .stats-grid-small {
        grid-template-columns: repeat(2, 1fr);
    }

    .user-detail-grid {
        grid-template-columns: 1fr;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .top-bar-actions {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
    }
}

/* ============================================
   MESSAGES PAGE
   ============================================ */

/* Messages list */
.messages-list {
    display: flex;
    flex-direction: column;
}

.message-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s;
}

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

.message-item:hover {
    background: var(--bg-body);
}

.message-item.unread {
    background: rgba(34, 113, 177, 0.03);
}

.message-item.unread .message-subject {
    font-weight: 600;
}

.message-status {
    width: 8px;
    padding-top: 6px;
    flex-shrink: 0;
}

.unread-dot {
    display: block;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.message-info {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 4px;
}

.message-subject {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.message-from {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.message-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-actions {
    flex-shrink: 0;
}

/* Message modal */
.message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-secondary);
}

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

.message-content {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Reply section */
.reply-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.reply-header {
    margin-bottom: 16px;
}

#toggleReplyBtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.reply-form {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.reply-to {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

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

#replyContent {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    background: #fff;
}

#replyContent:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.reply-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

#sendReplyBtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#sendReplyBtn .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Button small variant */
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Loading */
.messages-list .loading {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

/* Error */
.messages-list .error {
    text-align: center;
    padding: 48px 24px;
    color: var(--danger);
}

/* Stat card accent (for unread count) */
.stat-card-accent {
    border-left: 3px solid var(--primary);
}

/* Page buttons */
.page-btn {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.page-btn:hover:not([disabled]) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.page-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-dots {
    padding: 6px 8px;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .message-header {
        flex-direction: column;
        gap: 4px;
    }

    .message-actions {
        display: none;
    }
}

/* ============================================
   ANONYMOUS VISITORS SECTION
   ============================================ */

.anonymous-section {
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.section-header h2 svg {
    color: var(--primary);
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.anon-stats {
    margin-bottom: 24px;
}

.anon-stats .stat-icon.visitors {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.anon-stats .stat-icon.conversion {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.anon-stats .stat-icon.free-only {
    background: rgba(156, 163, 175, 0.1);
    color: #6b7280;
}

.anon-content-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .anon-content-row {
        grid-template-columns: 1fr;
    }
}

/* Visitor table styles */
.visitor-pseudonym {
    font-weight: 500;
    color: var(--text-primary);
}

.visitor-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    font-size: 10px;
    border-radius: 50%;
    vertical-align: middle;
}

.visitor-badge.registered {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

/* Module tags */
.module-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    margin: 1px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    background: rgba(100, 100, 100, 0.1);
    color: var(--text-secondary);
    cursor: default;
}

.module-tag.notes { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.module-tag.chords { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.module-tag.rhythm { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.module-tag.sightread { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.module-tag.progressions { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.module-tag.eartraining { background: rgba(234, 179, 8, 0.15); color: #ca8a04; }

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