/* ==========================================================================
   Authentication, RBAC & Admin Dashboard Styles
   ========================================================================== */

/* Header User Profile Widget */
.master-user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    font-size: 0.85rem;
}

.user-badge-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 24px;
    padding: 4px 12px 4px 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.user-avatar-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7, #6366f1);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    overflow: hidden;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name-label {
    font-weight: 600;
    color: #f1f5f9;
}

.user-role-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.role-super-admin { color: #f59e0b; }
.role-admin { color: #38bdf8; }
.role-user { color: #10b981; }
.role-pending { color: #ef4444; }

.auth-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0284c7;
    color: #ffffff;
    border: 1px solid #38bdf8;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-header-btn:hover {
    background: #0369a1;
}

.auth-logout-btn {
    background: transparent;
    border: 1px solid #475569;
    color: #94a3b8;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #fca5a5;
}

/* ==========================================================================
   Admin Dashboard Page
   ========================================================================== */

.admin-page-container {
    padding: 20px 24px;
    max-width: 1600px;
    margin: 0 auto;
    color: #e2e8f0;
}

.admin-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.6);
    padding-bottom: 16px;
}

.admin-title-group h2 {
    margin: 0 0 6px 0;
    font-size: 1.6rem;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-title-group p {
    margin: 0;
    color: #94a3b8;
    font-size: 0.9rem;
}

.admin-stat-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.admin-stat-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.admin-stat-label {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.admin-stat-val {
    font-size: 1.8rem;
    font-weight: 700;
    color: #f8fafc;
    margin-top: 6px;
}

/* Admin Sections / Panels */
.admin-card-panel {
    background: #131b2e;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 28px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.admin-panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-panel-subtitle {
    color: #94a3b8;
    font-size: 0.88rem;
    margin: 0 0 20px 0;
    line-height: 1.4;
}

/* Table styling */
.admin-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #1e293b;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.admin-table th {
    background: #0b0f19;
    color: #94a3b8;
    padding: 12px 14px;
    font-weight: 600;
    border-bottom: 1px solid #1e293b;
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.8);
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: rgba(30, 41, 59, 0.4);
}

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

.perm-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.perm-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid #334155;
    border-radius: 5px;
    padding: 4px 8px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
}

.perm-checkbox-label:hover {
    border-color: #38bdf8;
}

.perm-checkbox-label input[type="checkbox"] {
    accent-color: #0284c7;
    cursor: pointer;
}

/* Invite Generator Form */
.invite-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    background: #0b0f19;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 20px;
}

.form-group-admin {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group-admin label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
}

.form-control-admin {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #f8fafc;
    padding: 8px 12px;
    font-size: 0.88rem;
}

.form-control-admin:focus {
    outline: none;
    border-color: #38bdf8;
}

.invite-result-box {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    padding: 14px 18px;
    margin-top: 16px;
    display: none;
}

.invite-link-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.invite-link-input {
    flex: 1;
    background: #0f172a;
    border: 1px solid #334155;
    color: #38bdf8;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.88rem;
}

/* Access Restricted Page */
.restricted-page-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 24px;
}

.restricted-card {
    background: #131b2e;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 3rem 2.5rem;
    max-width: 540px;
    text-align: center;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

.restricted-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.restricted-title {
    color: #f87171;
    font-size: 1.6rem;
    margin: 0 0 12px 0;
}

.restricted-desc {
    color: #94a3b8;
    line-height: 1.6;
    font-size: 0.95rem;
    margin: 0 0 20px 0;
}
