* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* Login Styles */
.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.logo {
    max-width: 60px;
    height: auto;
    margin-bottom: 10px;
}

.login-box h1 {
    color: #667eea;
    margin-bottom: 10px;
    text-align: center;
}

.login-box h2 {
    color: #666;
    font-size: 18px;
    margin-bottom: 30px;
    text-align: center;
    font-weight: normal;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.btn-delete:hover {
    background-color: #c82333;
}

.btn-delete:active {
    background-color: #bd2130;
}

.btn-view {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-view:hover {
    background-color: #2980b9;
}

.btn-view:active {
    background-color: #21618c;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

.error-message {
    color: #e74c3c;
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Dashboard Styles */
#dashboard-container {
    display: block;
    padding: 0;
    align-items: flex-start;
}

.header {
    background: white;
    padding: 20px 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    max-width: 35px;
    height: auto;
}

.header h1 {
    color: #667eea;
    font-size: 24px;
    margin: 0;
}

.btn-secondary {
    padding: 10px 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #c0392b;
}

.dashboard-content {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 11px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-number {
    color: #667eea;
    font-size: 28px;
    font-weight: bold;
}

.stat-period {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    line-height: 1.3;
}

.stat-period span[id$="-1d"],
.stat-period span[id$="-1w"] {
    color: #16a34a;
    font-weight: 600;
}

.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters select,
.filters input {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
}

.content-filter-select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 150px;
}

.content-filter-select:hover {
    border-color: #667eea;
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.2);
}

.content-filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.content-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.content-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
}

.btn-approve-content:hover {
    background: #45a049 !important;
}

.btn-reject-content:hover {
    background: #da190b !important;
}

/* Hide Referral Link and Referred By columns by default */
/* But keep the "Referral Link" header visible so it can be clicked */
#toggle-referral-header {
    display: table-cell !important; /* Always show the header */
}

thead th.col-referred-by,
tbody td.col-referral-link,
tbody td.col-referred-by {
    display: none; /* Hide body cells and "Referred By" header by default */
}

/* Style for clickable header */
.toggle-header {
    user-select: none;
    transition: background-color 0.2s;
}

.toggle-header:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.filters input {
    flex: 1;
    min-width: 250px;
}

.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #667eea;
    color: white;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

tbody tr:hover {
    background: #f5f5f5;
}

.loading {
    text-align: center;
    color: #999;
    padding: 40px !important;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge.registered {
    background: #2ecc71;
    color: white;
}

.badge.unregistered {
    background: #95a5a6;
    color: white;
}

.badge.student {
    background: #3498db;
    color: white;
}

.badge.teacher {
    background: #9b59b6;
    color: white;
}

.badge.school_pupil {
    background: #16a085;
    color: white;
}

.badge.school_teacher {
    background: #8e44ad;
    color: white;
}

.badge.simple_person {
    background: #e67e22;
    color: white;
}

.actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.actions button {
    padding: 12px 24px;
}

@media (max-width: 768px) {
    .dashboard-content {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters {
        flex-direction: column;
    }

    .filters input {
        width: 100%;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px;
    }
}

/* New Dashboard Styles */
.dashboard-header {
    background: white;
    padding: 20px 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 10px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h1 {
    color: #667eea;
    margin: 0;
    font-size: 28px;
}

.page-description {
    color: #666;
    margin: 5px 0 0 0;
    font-size: 14px;
}

.page-content {
    padding: 0 30px 30px;
}

/* Quick Access Section */
.quick-access-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.section-title {
    color: #667eea;
    font-size: 22px;
    margin-bottom: 20px;
    font-weight: 600;
}

.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.quick-access-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    border-radius: 10px;
    text-decoration: none;
    color: white;
    transition: transform 0.3s, box-shadow 0.3s;
    display: block;
}

.quick-access-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.quick-access-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.quick-access-card h3 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 18px;
}

.quick-access-card p {
    color: rgba(255,255,255,0.9);
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Stat Card Enhancements */
.stat-card.clickable {
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card.clickable:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.stat-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.stat-link {
    font-size: 12px;
    color: #667eea;
    margin-top: 10px;
    font-weight: 600;
}

/* Dashboard in-place users panel (double-click a user-type card) */
.dashboard-users-panel {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.dashboard-users-panel.hidden {
    display: none !important;
}
.dashboard-users-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}
.dashboard-users-panel-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}
.dashboard-users-panel-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #e0e0e0;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #555;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dashboard-users-panel-close:hover {
    background: #667eea;
    color: white;
}
.dashboard-users-panel-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}
.dashboard-users-panel-loading.hidden {
    display: none !important;
}
.dashboard-users-panel-content {
    max-height: 400px;
    overflow: auto;
}
.dashboard-users-panel-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.dashboard-users-panel-content th,
.dashboard-users-panel-content td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.dashboard-users-panel-content th {
    background: #667eea;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}
.dashboard-users-panel-content tr:hover {
    background: #f0f0f0;
}
.dashboard-users-panel-content .col-id { width: 100px; }
.dashboard-users-panel-content .col-name { min-width: 140px; }
.dashboard-users-panel-content .col-phone { width: 120px; }
.dashboard-users-panel-content .col-type { width: 110px; }
.dashboard-users-panel-content .col-referred-by { min-width: 120px; max-width: 200px; }
.dashboard-users-panel-content .col-created { width: 140px; }
.dashboard-users-panel-content .col-view { width: 80px; }
.dashboard-users-panel-content .btn-view {
    display: inline-block;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    background: #3498db;
    color: white;
    font-size: 12px;
}
.dashboard-users-panel-content .btn-view:hover {
    background: #2980b9;
    color: white;
}
.stat-card-users {
    cursor: pointer;
}
.stat-card-users:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Recent Activity */
.recent-activity-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    font-size: 24px;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.activity-time {
    font-size: 12px;
    color: #999;
}

/* Page Header */
.page-header {
    background: white;
    padding: 25px 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 10px;
}

.page-header h1 {
    color: #667eea;
    margin: 0 0 5px 0;
    font-size: 26px;
}

/* Stats Bar */
.stats-bar {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    padding: 15px;
    min-width: 120px;
}

.stat-item-number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-item-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

