/* ======================================
   Fonts
========================================= */

@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter_18pt-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter_18pt-Medium.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter_18pt-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter_18pt-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
}


/* ======================================
   Theme Variables
========================================= */
/* Add 0066CC and 3159C9 colors*/

:root {
    /* Colors */
    --primary: #2563EB;
    --secondary: #4267B2;
    --soft-color: #296BBC3E;
    --notification: #ef4444;
    --bubble: #F3F4F6;

    --background: #F0F2F5;
    --card: #FFFFFF;

    --text: #111827;
    --muted-text: #6B7280;

    --border: #E5E7EB;
    --border-strong: #333333;
    --avatar-border: #333333;

    /* Messages */
    --error: #B91C1C;
    --error-background: #FEE2E2;

    --success: #15803D;
    --success-background: #DCFCE7;

    --info: #2563EB;
    --info-background: #DBEAFE;

    /* Gradients */
    --masthead-background: linear-gradient(
        179deg,
        var(--primary) 12%,
        var(--background) 100%
    );
    --hero-background: linear-gradient(
        180deg,
        rgba(37, 99, 235, 0.08),
        transparent
    );
    --header-background: linear-gradient(
        135deg,
        rgba(37, 99, 235, 0.5),
        transparent,
        rgba(66, 103, 178, 0.5)
    );

    /* Typography */
    --font-family: "Inter", sans-serif;
    --font-size-base: 16px;

    /* Sizes */
    --card-radius: 16px;
    --button-radius: 12px;

    /* Effects */
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);

    /* Glass effects*/
    --glass-background: rgba(255, 255, 255, 0.20);
    --glass-border: rgba(50, 50, 50, 0.25);
    --glass-blur: 12px;
    --glass-hover: rgba(37, 99, 235, 0.12);

    /* Sepatators*/
    --nav-divider: rgba(17, 24, 39, 0.25);
}

/* Dark theme */
[data-theme="dark"] {
    --primary: #2563EB;
    --secondary: #4267B2;
    --soft-color: #1E3A5FF7;
    --bubble: #7089bc;

    --background: #0F172A;
    --card: #1E293B;

    --text: #F8FAFC;
    --muted-text: #CBD5E1;

    --border: #334155;
    --avatar-border: #777777;

    --error: #FCA5A5;
    --error-background: #3F1D1D;

    --success: #86EFAC;
    --success-background: #1A3A28;

    --info: #93C5FD;
    --info-background: #1E3A5F;

    --masthead-background: linear-gradient(
        179deg,
        var(--primary) 12%,
        var(--background) 100%
    );
    --hero-background: linear-gradient(
        180deg,
        rgba(37, 99, 235, 0.15),
        transparent
    );
    --header-background: linear-gradient(
        135deg,
        rgba(37, 99, 235, 0.3),
        transparent,
        rgba(30, 64, 175, 0.3)
    );

    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);

    --glass-background: rgba(30, 41, 59, 0.55);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-hover: rgba(37, 99, 235, 0.18);

    --nav-divider: rgba(255, 255, 255, 0.15);
}


/* ======================================
   Global Layout
========================================= */

* {
    box-sizing: border-box;
}

header {
    background: var(--masthead-background);
}

body {
    margin: 0;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    background: var(--background);
    color: var(--text);

    min-height: 95vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}


/* ======================================
   Typography
========================================= */

h1, h2, h3 {
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

p {
    color: var(--text);
}

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

.character-counter {
    font-size: 0.85rem;
    color: var(--muted-text);
    text-align: right;
    margin-top: 0.25rem;
    margin-right: 1.2rem;
}

/* ======================================
   Links
========================================= */

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* ======================================
   Components
========================================= */


/* Icons */

.icon {
    width: 1.2em;
    height: 1.2em;
    padding-bottom: 2px;
}


/* Hero*/

.hero {
    background: var(--hero-background);
    text-align: center;
    padding: 5rem 1rem
}

.hero h1 {
    font-size: 3rem;
}

.hero p {
    max-width: 600px;
    margin: 1rem auto;
    color: var(--muted-text);
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}


/* Features */

.features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 3rem 1rem;
}

.features h3 {
    border-bottom: 3px dotted var(--border);
}

.features p {
    margin-top: 0.5rem;
}


/* Decoration */

.landing-decoration {
    position: fixed;
    left: -85px;
    top: -25px;
    width: auto;
    pointer-events: none;
    z-index: -1;
}


/* Authentication */

.auth-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 70vh;
    gap: 1.5rem;
    padding: 3rem 1rem 10rem;
}

.auth-container h1 {
    font-size: 1.8rem;
}

.auth-container .card {
    width: 100%;
    max-width: 28rem;
}

.form-button {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
}

.auth-message {
    font-size: 0.8rem;
    color: var(--error);
    margin: 0;
    margin-left: 1rem;
}

/* Container to group the satellite tools and the main field tightly */
.registration-form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0.5rem 0;
}

/* The small satellite row floating directly on top */
.generator-controls {
    display: flex;
    justify-content: space-between; /* Pushes nickname to the far left and button to the far right */
    align-items: flex-end;
    width: 100%;
    margin-bottom: 4px; /* Small, clean separation gap above the main username box */
}

/* Shrinks the nickname input to look like a small left-aligned satellite */
.input.nickname-field {
    width: auto;
    max-width: 130px; /* Compact width footprint */
    font-size: 11px; /* Tiny text scale */
    padding: 4px 8px; /* Minimal padding */
    margin: 0;
    height: 24px; /* Shorter height profile */
    border-radius: var(--button-radius); /* Matches your custom rounded system theme */
    background: var(--background);
}

/* Shrinks the Roll Name button into a small right-aligned companion tool */
.roll-button {
    padding: 4px 8px;
    height: 24px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--button-radius);
    border: 1.5px solid var(--border);
    background: var(--info);
    color: var(--card);
    cursor: pointer;
    margin: 0;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: filter 0.15s ease;
}

.roll-button:hover {
    filter: brightness(1.1);
}

/* Ensures the main read-only output box retains its standard layout styling */
.username-output-field[readonly] {
    margin-top: 0 !important;
    cursor: not-allowed;
    font-weight: bold;
    background: var(--background) !important;
    color: var(--muted-text) !important;
}


/* Admin Page */

.admin-page {
    padding: 3rem 1rem 4rem;
    max-width: 1120px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-top: 0.5rem;
    border-bottom: 2px solid var(--border-strong);
    border-top: 2px solid var(--border-strong);
}

.admin-header h1 {
    font-size: 2.4rem;
}

.admin-header p {
    color: var(--muted-text);
    margin-left: 6rem;                       
}


/* Admin Dashboard */

.school-summary {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.school-card {
    padding: 2rem;
    min-height: 210px;
}

.school-card h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.school-details {
    display: grid;
    gap: 1rem;
}

.school-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    background: var(--background);
    border: 1px solid var(--border);
}

.school-detail span {
    color: var(--muted-text);
    font-size: 0.95rem;
}

.school-detail strong {
    color: var(--text);
}

.admin-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    justify-items: stretch;
}

.metric-card {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 150px;
    text-align: center;
    margin: 0 4rem;
}

.metric-card h3 {
    color: var(--muted-text);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.metric-card p {
    font-size: 2.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.members-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 2rem;
}

.members-section-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.members-section h2 {
    margin: 0;
}

.members-section p {
    margin: 0;
    color: var(--muted-text);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
}

.table th,
.table td {
    vertical-align: middle;
    border-color: var(--border);
    padding: 1rem 0.75rem;
}

.table thead th {
    border-bottom-width: 2px;
}


@media (max-width: 768px) {
    .school-card,
    .metric-card,
    .members-section {
        padding: 1.5rem;
    }

    .admin-header {
        align-items: flex-start;
    }
}


/* Student Page*/

.student-page {
    padding: 3rem 1rem 4rem;
    max-width: 1120px;
    margin: 0 auto;
}

.student-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-top: 0.5rem;
    border-bottom: 2px solid var(--border-strong);
    border-top: 2px solid var(--border-strong);
    border-radius: var(--card-radius);
    background: var(--header-background);
    backdrop-filter: 12px;
}

.student-header h1 {
    justify-self: center;
    font-size: 2.4rem;
}

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


/* Settings */

.settings-content-container {
    display: flex;
    flex-direction: column;
}

.settings-content-container h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    border-bottom: 3px dotted var(--border);
}

.settings-content-container p {
    margin: 0;
    color: var(--muted-text);
}

.settings-content-container .form-check {
    margin-left: auto;
}

.settings-content-container .form-check-input {
    transform: scale(1.4);
}

.settings-card {
    margin: 0 3rem;
}


/* Authentication */

.auth-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 70vh;
    gap: 1.5rem;
    padding: 3rem 1rem 10rem;
}

.auth-container h1 {
    font-size: 1.8rem;
}

.auth-container .card {
    width: 100%;
    max-width: 28rem;
}
.form-button {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
}


/* Cards */

.card {
    background: var(--card);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.info-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    justify-self: center;
    width: 100%;
    max-width: 30rem;
}

.info-card h3 {
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
}

.info-card p {
    margin-bottom: 0;
}

/* Messages */

.flash {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px;

    opacity: 1;
    transition: opacity 0.5s ease;
}

.flash.fade-out {
    opacity: 0;
}
.flash-error {
    color: var(--error);
    background: var(--error-background);
    border: 1px solid var(--error);
}

.flash-success {
    color: var(--success);
    background: var(--success-background);
    border: 1px solid var(--success);
}

.flash-info {
    color: var(--info);
    background: var(--info-background);
    border: 1px solid var(--info);
}

/* Dynamic Alerts */

#floating-alert-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999995;
    pointer-events: none;
}

.floating-alert {
    position: relative;
    pointer-events: auto;
    box-sizing: border-box;
    overflow: hidden;
    
    /* Start completely collapsed */
    max-height: 0;
    padding: 0 24px;
    margin-top: 0;
    opacity: 0;
    transform: translateX(50px);
    
    /* Smooth transitions for moving, scaling, and fading */
    transition: 
        max-height 0.3s ease, 
        padding 0.3s ease, 
        margin-top 0.3s ease,
        opacity 0.3s ease, 
        transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Opens the vertical space */
.floating-alert.expand-space {
    max-height: 100px; /* Big enough to hold multi-line text safely */
    padding: 16px 24px;
    margin-top: 10px;
}

/* Newest alert state */
.floating-alert.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

/* --- AGE STYLING CLASSES --- */
/* Recent alerts (positions 2 and 3 from bottom) fade slightly */
.floating-alert.age-medium {
    opacity: 0.7;
    transform: scale(0.96);
}

/* Older alerts (positions 4 and 5) get significantly fainter and smaller */
.floating-alert.age-old {
    opacity: 0.4;
    transform: scale(0.92);
}

/* Ancient alerts (positions 6+) fade to the absolute limit before disappearing */
.floating-alert.age-ancient {
    opacity: 0.15;
    transform: scale(0.88);
}

/* Your exact color variables remain the same below here */
.error { color: var(--error); background: var(--error-background); border: 1px solid var(--error); }
.success { color: var(--success); background: var(--success-background); border: 1px solid var(--success); }
.info { color: var(--info); background: var(--info-background); border: 1px solid var(--info); }


/* Modal */

.modal-content {
    background: var(--glass-background);
    color: var(--text-color);
    border: 1px solid var(--border-strong);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(8px);
}

.modal-header {
    border-bottom: 1px dotted var(--border-color);
}

.modal-footer {
    border-top: 1px dotted var(--border-color);
}


/* Feed style */

.feed-container {
    width: 97%;
    justify-self: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--card-radius);
    margin: 0.5rem 0.8rem 1rem 0.8rem;
}

.empty-feed {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dotted var(--border-strong);
    border-radius: var(--card-radius);
    padding: 20%;
}

.empty-feed p {
    font-size: 1rem;
    font-weight: 800;
}


.self-post-card {
    background: var(--soft-color);
    color: var(--text);

    border: 1px solid var(--border-strong);
    border-radius: 16px;

    padding: 0.5rem;
    margin: 0.5rem 0.8rem 1rem 10rem;

    box-shadow: var(--card-shadow);
    backdrop-filter: blur(12px);
}

.post-card {
    background: var(--card);
    color: var(--text);

    border: 1px solid var(--border-color);
    border-radius: 16px;

    padding: 0.5rem;
    margin: 0.5rem 10rem 1rem 0.8rem;

    box-shadow: var(--card-shadow);
    backdrop-filter: blur(12px);
}

/* Top section: avatar + username + time */
.post-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;

    margin-bottom: 1rem;

    color: inherit;
    text-decoration: none;
}

.post-avatar {
    width: 45px;
    height: 45px;

    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--avatar-border);
}

.post-user {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.post-time {
    display: block;

    color: var(--muted-text-color);
    font-size: 0.8rem;
}

/* Message */
.post-content {
    margin: 0;

    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}


/* Refresh Posts */
#new-posts-alert {
    justify-self: end;
    position: relative;
}


.notification-text {
    align-items: center;
    justify-content: center;

    position: absolute;
    top: -5px;
    right: -5px;

    min-width: 20px;
    height: 20px;
    padding: 0 6px;

    background: var(--notification);
    color: var(--background);

    border-radius: 999px;

    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

/* Send Post */

.post-form {
    display: flex;
    align-items: center;
    gap: 0.01rem;
    background: var(--card);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    padding: 0 2px;
    margin: 5rem 0.8rem 0 0.8rem;
}

.post-form textarea {
    flex: 1;
    width: 100%;
    height: 30px;
    max-height: 150px;
    
    resize: vertical;

    border: none;
    border-radius: var(--button-radius);
    outline: none;
    
    background-color: transparent;
    color: var(--text);
    font-family: inherit;
    
    padding: 3px;
    padding-left: 1rem;
}

.post-form button {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
    border-radius: var(--button-radius);
    cursor: pointer;
    padding: 6px 18px;
    margin: 2px;
    margin-left: auto;
}

/* profile */

.profile-layout {
    display: grid;
    gap: 1.5rem;
    max-width: 980px;
    margin: 2rem auto;
    padding: 1.75rem;
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    background: var(--card);
}

.profile-main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5rem;
}

.profile-avatar {
    width: 140px;
    height: 140px;
    min-width: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--avatar-border);
    margin: 0;
}

.profile-summary {
    flex: 1;
    min-width: 240px;
    display: grid;
    gap: 1rem;
}

.profile-details {
    display: grid;
    gap: 1rem;
}

.profile-detail {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 16px;
    background: var(--hero-background);
    border: 1px solid var(--border);
    min-width: 0;
}

.profile-detail span {
    color: var(--muted-text);
    font-size: 0.95rem;
    line-height: 1.6;
    word-break: break-word;
}

.profile-detail strong {
    color: var(--text);
    font-size: 0.95rem;
}

.profile-divider {
    border: none;
    height: 1px;
    background: var(--border);
    opacity: 0.65;
    margin: 0;
}

.profile-layout .feed-container {
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
}

.profile-layout .post-card,
.profile-layout .self-post-card {
    margin: 0.75rem 0;
}

.profile-posts h3 {
    margin: 0;
}

/* profile Editing */

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
}

.profile-form-buttons {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.profile-bio-box {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--card);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    padding: 0 2px;
    margin-top: 1rem 0;
}

.bio-textarea {
    flex: 1;
    width: 100%;
    height: 30px;
    min-height: 150px;
    
    resize: vertical;

    border: none;
    border-radius: var(--button-radius);
    outline: none;
    
    background-color: transparent;
    color: var(--text);
    font-family: inherit;
    
    padding: 0.5rem 1rem;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 0.75rem;
}

.avatar-option input {
    display: none;
}

.avatar-option img {
    width: 64px;
    height: 64px;
    min-width: 64px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
}

.avatar-option input:checked + img {
    border-color: var(--secondary);
    background: var(--soft-color);
}

/* Buttons */

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--button-radius);
    padding: 10px 18px;
    cursor: pointer;
}

.btn-primary:hover {
    opacity: 0.9;
}

/* Distinct non-clickable style when the button is locked */
.btn-primary:disabled {
    background: #cccccc;      /* Soft, distinct disabled gray */
    color: #888888;           /* Faded text color */
    opacity: 0.6;             /* Semi-transparent look */
    cursor: not-allowed;      /* Changes mouse cursor to a blocked circle 🚫 */
    pointer-events: none;     /* Completely stops any mouse hover or click event triggers */
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: var(--button-radius);
    padding: 10px 18px;
    cursor: pointer;
}

.btn-secondary:hover {
    opacity: 0.9;

}

.btn-danger-action {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
    border-radius: var(--button-radius);
    cursor: pointer;
    padding: 8px 18px;
    margin-left: auto;
}

.btn-danger-action:hover {
    color: var(--error);
    background: var(--error-background);
} 

.glass-button {
    color: var(--text);
    background: var(--glass-background);

    border: 1px solid var(--glass-border);

    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));

    border-radius: var(--button-radius);

    padding: 8px 18px;

    transition: 0.2s ease;
}

.glass-button:hover {
    background: var(--glass-hover);
    color: var(--primary);
}


/* Glass links*/

.glass-link {
    color: var(--text);
    padding: 8px 16px;
    border-radius: 12px;
    transition: 0.2s ease;
}

.glass-link:hover {
    background: var(--glass-hover);
    color: var(--primary);
}


/* Inputs */

.input {
    width: 100%;
    padding: 12px;
    border-radius: var(--button-radius);
    border: 1.5px solid var(--border);
    background: var(--card);
    color: var(--text);
    margin: 0.5rem 0;
    margin-bottom: 0;
}

.input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--info-background);
}

.error-input {
    border: 2px solid var(--error);
}

.success-input {
    border: 2px solid var(--success);
}

/* =====================================================================
   DASHBOARD SPLIT-PANE REAL-TIME CHAT LAYOUT
   ===================================================================== */

#chat-split-layout {
    display: flex;
    width: 100%;
    height: calc(100vh - 110px);
    min-height: 500px;
    max-height: calc(100vh - 110px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

#chat-sidebar-list {
    width: 320px;
    min-width: 320px;
    height: 100%;
    background: var(--background);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(37, 99, 235, 0.04);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.create-chat-trigger-btn {
    border: 1px solid var(--primary);
    background: var(--primary);
    color: white;
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.sidebar-rooms-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.chat-room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chat-room-item.active {
    background-color: var(--action-hover, rgba(0, 0, 0, 0.05));
    border-left: 4px solid var(--primary, #007bff);
}

.chat-room-item:hover {
    background: rgba(37, 99, 235, 0.06);
}

/* Sidebar Category Section Header Labels */
.sidebar-list-category-label {
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 14px 6px;
    user-select: none;
}

/* Pending Invite Row Box layout override values */
.chat-room-item.invite-pending-item {
    cursor: default; /* Disable chat room finger cursor since clicking the row doesn't open it */
}

/* Action button container tray metrics */
.chat-invite-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

/* Core invitation action toggle button specifications */
.chat-invite-btn {
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.1s ease, opacity 0.2s ease;
}

.chat-invite-btn:active {
    transform: scale(0.96);
}

/* Accept style profile variables mapped directly to your theme colors */
.chat-invite-btn.btn-accept {
    color: var(--success);
    background-color: var(--success-background);
}
.chat-invite-btn.btn-accept:hover {
    opacity: 0.85;
    border-color: var(--success);
}

/* Decline style profile variables mapped directly to your theme colors */
.chat-invite-btn.btn-decline {
    color: var(--error);
    background-color: var(--error-background);
}
.chat-invite-btn.btn-decline:hover {
    opacity: 0.85;
    border-color: var(--error);
}

/* Styling for the fallback empty requests placeholder text */
.empty-category-text {
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-style: italic;
    color: var(--muted-text);
    padding: 8px 14px;
    margin: 0;
    user-select: none;
}


.room-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--hero-background);
    font-size: 1.2rem;
}

/* Child rule: Forces the image to center inside your grid layout */
.room-avatar img.profile-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%; /* Matches the wrapper circle */
    object-fit: cover; /* Prevents stretching */
    display: block;
    margin: 0;
    padding: 0;
}

/* Position alignment helper for the active conversation header bar */
.chat-active-room-header {
    position: relative; /* Essential anchor point for the absolute dropdown card */
}

/* Members Menu Action Toggle Button styling rules */
.chat-header-members-toggle-btn {
    margin-left: auto; /* Pushes the button to the absolute right side */
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: var(--button-radius, 12px); /* Uses your theme variable */
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-header-members-toggle-btn:hover {
    background-color: var(--soft-color); /* Uses your soft-color theme variable */
}

/* Floating Dropdown Menu Card Layout */
.chat-members-dropdown-panel {
    display: none; /* Hidden by default state values */
    position: absolute;
    top: 55px; /* Floats directly below the active header line boundary */
    right: 16px;
    width: 220px;
    max-height: 280px;
    background: var(--card); /* Adapts to light/dark themes natively */
    border: 1px solid var(--border);
    box-shadow: var(--shadow); /* Uses your theme's native shadows */
    border-radius: var(--card-radius, 16px); /* Uses your card radius theme variable */
    z-index: 999; /* HIGHER LAYER: Forces it on top of all chat messages and bubbles */
    flex-direction: column;
}

/* Display helper toggled by JavaScript class list toggle method */
.chat-members-dropdown-panel.active {
    display: flex;
}

.dropdown-header-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-text);
    text-transform: uppercase;
    padding: 10px 14px 6px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-family);
}

.dropdown-members-scroll-box {
    overflow-y: auto;
    flex: 1;
    padding: 6px;
}

/* Clickable Link Row metrics with matching feed hover decoration metrics */
.dropdown-member-row-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: background-color 0.2s ease;
    font-family: var(--font-family);
}

.dropdown-member-row-link:hover {
    background-color: var(--soft-color);
}

.dropdown-member-row-link:hover .member-row-username {
    text-decoration: underline; /* Matches link hover mechanics */
}

.member-row-username {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

/* Scaled room avatar handler override configuration helper */
.small-avatar.room-avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.8rem;
}

/* Styling to keep the (You) indicator soft and uniform */
.chat-you-tag {
    color: var(--muted-text);
    font-size: 0.8rem;
    font-weight: 400;
    margin-left: 4px;
}


/* Container to position the options layout relative to the header line */
.chat-header-actions-wrapper {
    position: relative;
    display: inline-block;
    margin-left: auto;
}

/* Clear styles for the three dots character button */
.chat-header-dots-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 8px;
    color: inherit;

}

/* Context styling to drop down the options box panel cleanly */
.chat-options-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    z-index: 1000;
}

/* State mapping rules to run display toggles dynamically via DOM class variables */
#chat-options-dropdown.active {
    display: flex !important;
}

/* Flex rows block inside the options target dropdown box */
.chat-options-buttons-list {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Resizing adjustments to scale block-line items inside the dropdown context */
.block-action-btn {
    width: 100% !important;
    text-align: left;
}

.no-margin {
    margin: 0 !important;
}


.room-title {
    font-size: 0.96rem;
    font-weight: 500;
}

.empty-rooms-text {
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-style: italic;
    color: var(--muted-text);
    padding: 8px 14px;
    margin: 0;
    user-select: none;
}

#chat-conversation-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: var(--card);
}

#chat-conversation-pane > * {
    flex-shrink: 0;
}

.chat-empty-placeholder {
    margin: auto;
    text-align: center;
    max-width: 420px;
    padding: 32px;
    color: var(--muted-text);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.chat-empty-placeholder h3 {
    margin-bottom: 8px;
    color: var(--text);
}

.chat-active-room-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(37, 99, 235, 0.02);
    flex-shrink: 0;
}

.active-room-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.sidebar-room-unread-dot {
    background-color: var(--notification, #ef4444);
    color: #ffffff;
    font-family: var(--font-family);
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    flex-shrink: 0;
}

.chat-mobile-back-btn {
    display: none;
}

#chat-messages-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 72%;
}

.chat-bubble-wrapper.incoming {
    align-self: flex-start;
}

.chat-bubble-wrapper.outgoing {
    align-self: flex-end;
}

.chat-sender-name {
    font-size: 0.72rem;
    color: var(--muted-text);
    margin: 0 0 4px 8px;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.incoming .chat-bubble {
    background: var(--bubble);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.outgoing .chat-bubble {
    background: var(--soft-color);
    color: var(--text);

    border-bottom-right-radius: 4px;
}

.chat-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

.chat-timestamp {
    display: block;
    margin-top: 6px;
    font-size: 0.62rem;
    opacity: 0.8;
    text-align: right;
}

.chat-date-divider {
    color: var(--muted-text);
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    opacity: 0.8;
    text-align: center;
}

.chat-input-panel-wrapper {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--card);
    flex-shrink: 0;
}

.chat-input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-textarea-box {
    flex: 1;
    height: 53px; /* Base structural height matching your layout */
    min-height: 53px;
    max-height: 140px;
    padding: 8px 14px; /* Perfectly balanced for line-height alignment */
    line-height: 22px; /* Explicit control so text rows don't fight padding metrics */
    border: 1px solid var(--border);
    color: var(--text);
    background-color: transparent;
    border-radius: 12px;
    resize: none; /* Disables manual dragging breaks */
    font-family: inherit;
    font-size: 0.95rem;
    box-sizing: border-box; /* Forces padding inline with height values */
    overflow-y: auto; /* Handles text overflow gracefully past max-height */
    display: block;
}

.chat-send-btn-icon {
    border: none;
    background: var(--secondary);
    color: white;
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
}

#create-chat-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card-body {
    background: var(--card);
    width: min(92vw, 420px);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.modal-card-body h4 {
    margin: 0 0 16px;
}

.chat-input-field {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 0.9rem;
    margin-bottom: 14px;
}

.member-picker-label {
    display: block;
    margin: 8px 0 10px;
    font-weight: 600;
}

#modal-user-picker-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: var(--background);
}

.user-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    cursor: pointer;
}

.modal-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.btn-cancel,
.btn-submit {
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-submit {
    border: none;
    background: var(--primary);
    color: white;
}

@media (max-width: 767px) {
    #chat-split-layout {
        min-height: calc(100vh - 100px);
    }

    #chat-sidebar-list {
        width: 100%;
        min-width: 100%;
    }

    #chat-conversation-pane {
        display: none;
    }

    #chat-split-layout.chat-active #chat-sidebar-list {
        display: none;
    }

    #chat-split-layout.chat-active #chat-conversation-pane {
        display: flex;
        width: 100%;
    }

    .chat-mobile-back-btn {
        display: inline-block;
        border: none;
        background: transparent;
        color: var(--primary);
        font-weight: 600;
        cursor: pointer;
    }
}


/* ======================================
   Reusable Effects
========================================= */

/* Global Navigation Red Alert Badge Metrics */
.global-masthead-unread-badge {
    position: absolute;
    top: 2px;
    right: -4px;
    background-color: var(--notification, #ef4444);
    color: #ffffff;
    font-family: var(--font-family);
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    z-index: 10;
    animation: badgeScaleIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Sharp pop-in movement effect scale animation */
@keyframes badgeScaleIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}


/* Forces the mobile hamburger button dot to stack correctly over Bootstrap elements */
#mobile-navbar-hamburger-btn {
    position: relative; /* Essential anchor point */
}

#mobile-nav-unread-dot.global-masthead-unread-badge {
    position: absolute !important;
    top: -4px !important;    /* Adjusts position to sit right on top corner */
    right: -4px !important;  /* Adjusts position to sit right on top corner */
    z-index: 1050 !important; /* Layers it securely on top of the icon lines */
}


/* ==========================================================================
   The Guardian Guard Companion - Human-Centric UI
   ========================================================================== */

.support-guardian-companion {
    position: fixed;
    bottom: 28px;
    right: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Elegant, premium capsule boundaries */
    background: var(--header-background);
    border: 1px solid var(--border-strong);
    padding: 12px;
    border-radius: 40px;
    height: 48px;
    min-width: 48px;
    cursor: pointer;
    z-index: 1040;
    
    /* Smooth, lifelike physics layout */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.support-guardian-companion .companion-icon {
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s ease;
}

.support-guardian-companion .companion-text {
    max-width: 0;
    opacity: 0;
    white-space: nowrap;
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    transition: max-width 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    padding-left: 0;
}

/* ==========================================
   Desktop Hover Animation Spectrum
   ========================================== */
@media (min-width: 576px) {
    .support-guardian-companion:hover {
        padding: 12px 20px;
        background: var(--header-background);
        border-color: var(--border-strong);
        transform: translateY(-2px);
        box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12), 0 4px 10px rgba(0, 0, 0, 0.04);
    }

    .support-guardian-companion:hover .companion-text {
        max-width: 200px;
        opacity: 1;
        padding-left: 8px;
    }

    .support-guardian-companion:hover .companion-icon {
        transform: scale(1.1) rotate(5deg);
    }
}

/* ==========================================
   📱 Mobile-First Optimization Rules
   ========================================== */
@media (max-width: 575.98px) {
    .support-guardian-companion {
        bottom: 16px;
        right: 16px;
        height: 42px;
        min-width: 42px;
        width: 42px; /* Lock into a perfect tiny circle */
        padding: 0;
        background: var(--card);
        border: 1px solid var(--border);
        box-shadow: var(--shadow);
    }
    
    /* Completely hide the text string on phones to prevent clipping */
    .support-guardian-companion .companion-text {
        display: none !important;
    }
    
    .support-guardian-companion .companion-icon {
        font-size: 1.1rem;
    }
}


.support-modal-container {
    background: var(--card);
    color: var(--text);
    border-radius: var(--card-radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.support-modal-header {
    border-color: var(--border) !important;
}

.support-modal-title {
    font-family: var(--font-family);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.support-modal-body {
    text-align: left;
    font-family: var(--font-family);
}

.support-modal-card {
    background: var(--background);
    border: 1px solid var(--border);
}

.support-modal-heading-safe {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--primary);
}

.support-modal-heading-idea {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--success);
}

.support-modal-heading-lock {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--error);
}

.support-modal-text-muted {
    color: var(--muted-text);
    font-size: 0.85rem;
    margin: 0 0 12px 0;
}

.support-modal-btn-safe {
    background-color: var(--soft-color);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.support-modal-btn-idea {
    background-color: var(--success-background, #DCFCE7);
    color: var(--success);
    border: 1px solid var(--success);
}

.support-modal-btn-lock {
    background-color: var(--error-background);
    color: var(--error);
    border: 1px solid var(--error);
}

.support-modal-footer {
    border-color: var(--border) !important;
}

.support-modal-btn-close {
    border-radius: var(--button-radius);
    background: var(--background);
    color: var(--text);
}

.modal-support-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: var(--button-radius);
    text-decoration: none;
    transition: background-color 0.2s ease;
}


.glass {
    background: var(--glass-background);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));

    border: 1px solid var(--glass-border);

    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
}

.glass-navbar {
    background: var(--glass-background);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));

    border: 1.4px solid var(--glass-border);
}

.invert {
    filter: invert(1);
}


/* ======================================
   Navigation
========================================= */

.brand-icon {
    width: 40px;
    height: 40px;
    margin-right: 1rem;
    flex-shrink: 0;
}

@media (max-width: 991px) {
    .navbar-collapse .navbar-nav {
        align-items: flex-end;
    }
    .navbar-collapse .nav-item {
        width: fit-content;
    }

    .navbar-collapse {
        border-top: 1px solid var(--nav-divider);
        margin-top: 12px;
        padding-top: 12px;
        align-items: flex-end;
    }

    .admin-card {
        flex-basis: 100%;
    }

    .admin-header h1 {
        font-size: 1.8rem;
    }

    .post-card {
        margin-right: 3rem;
    }

    .self-post-card {
        margin-left: 3rem;
    }

    .profile-layout {
        flex-wrap: wrap;
    }

    .profile-avatar {
        margin-left: auto;
        margin-right: auto;
    }
}

/* ==========================================================================
   Legal Framework Modules (ToS & Privacy Layouts)
   ========================================================================== */

.policy-card {
    background: var(--card);
    border-radius: var(--card-radius);
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.policy-title {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.policy-meta {
    color: var(--muted-text);
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
}

.policy-divider {
    border-color: var(--border);
    margin: 1.5rem 0;
    opacity: 1;
}

.policy-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.policy-text {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text);
}

/* ==========================================================================
   Authorization Footer Disclosure
   ========================================================================== */

.auth-disclosure-text {
    font-size: 0.75rem;
    color: var(--muted-text);
    text-align: center;
    margin-top: 1.5rem;
    line-height: 1.4;
}

.auth-disclosure-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-disclosure-text a:hover {
    text-decoration: underline;
}


/* ======================================
   Footer
========================================= */

.footer {
    padding: 1rem 0;
    color: var(--muted-text);
    border-top: 1px solid var(--border);
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.footer-brand {
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
    padding-left: 1rem;
    margin-bottom: 0.5rem;

}

.footer-links {
    display: flex;
    gap: 2rem;
    padding-right: 1rem;
}

.footer-links a {
    color: var(--text);
    font-size: smaller;

}

.footer-links a:hover {
    color: var(--primary);
    cursor: pointer;

}

.footer-copy {
    font-size: 0.7rem;
    color: var(--muted-text);
    margin-top: 0;
    justify-self: center;
}
