/* ===========================
   Global Styles
   =========================== */
html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    background-color: #1d232b;
}

/* ===========================
   Auth Pages (Login & Register)
   =========================== */
.auth-background {
    background: linear-gradient(to right, #3b82f6, #a855f7);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* ===========================
   Chat Page Styles
   =========================== */

/* Chat Messages Container */
#chatMessages {
    overflow-y: auto;
}

/* Chat FIX FOR REVERSE */
#chatMessages > :first-child{
    margin-top: auto;
}

#chatMessages::-webkit-scrollbar {
    width: 8px;
}

#chatMessages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Online Users Container */
#onlineUsers {
    overflow-y: auto;
    scroll-behavior: smooth;
}

#onlineUsers::-webkit-scrollbar {
    width: 6px;
}

#onlineUsers::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#onlineUsers::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#onlineUsers::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Message Size */
.message-size {
    word-wrap: break-word;
}

/* Online Indicator */
.online-indicator {
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
}

/* ===========================
   Admin Page Styles
   =========================== */

/* Main Content Scrollbar */
.main-content {
    overflow-y: auto;
}

.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.main-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Sidebar Link Active State */
.sidebar-link.active {
    background-color: #dbeafe;
    border-left: 4px solid #2563eb;
    padding-left: calc(1rem - 4px);
}

/* ===========================
   Chat Sidebar Toggle (Responsive)
   =========================== */

/* Base sidebar styles */
.sidebar-toggle {
    /* Width is controlled by Tailwind classes (w-64, w-72, etc.) */
    width: 0 !important;
    overflow: hidden;
}

/* Left sidebar - hidden by default to prevent flash */
.left-sidebar-toggle {
    /* Width is controlled by Tailwind classes (w-64, w-72, etc.) */
    width: 0 !important;
    overflow: hidden;
}

/* ================= MOBILE ================= */
@media (max-width: 767px) {
    .sidebar-toggle {
        position: fixed !important;
        top: 48px !important;
        right: 0 !important;
        height: calc(100vh - 96px) !important; /* Full height minus navbar and bottom bar */
        transform: translateX(100%) !important;
        z-index: 40 !important;
        width: 18rem !important;
    }

    /* Show on mobile */
    .sidebar-toggle.active {
        transform: translateX(0) !important;
    }

    /* Left sidebar mobile styles */
    .left-sidebar-toggle {
        position: fixed !important;
        top: 48px !important; /* Height of navbar */
        left: 0 !important;
        height: calc(100vh - 96px) !important; /* Full height minus navbar and bottom bar */
        transform: translateX(-100%) !important;
        z-index: 40 !important;
        width: 18rem !important; /* w-72 */
        overflow: visible !important;
    }

    .left-sidebar-toggle.active {
        transform: translateX(0) !important;
    }
}

/* ================= DESKTOP ================= */
@media (min-width: 768px) {
    .sidebar-toggle {
        position: static;
        transform: none;
    }

    /* Show right sidebar on desktop when not collapsed */
    .sidebar-toggle:not(.collapsed) {
        width: 18rem !important;
    }

    /* Hide on desktop */
    .sidebar-toggle.collapsed {
        width: 0;
        overflow: hidden;
    }

    /* Left sidebar styles - show on desktop when not collapsed */
    .left-sidebar-toggle {
        position: static;
        transform: none;
        visibility: visible;
    }

    /* Show left sidebar on desktop when not collapsed */
    .left-sidebar-toggle:not(.collapsed) {
        width: 18rem !important; /* w-72 */
    }
}

/* ===========================
   Toast Notifications
   =========================== */

.toast {
    min-width: 300px;
    max-width: 500px;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: toastSlideIn 0.3s ease-out;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.toast.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.toast.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.toast .toast-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast .toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.toast .toast-close {
    background: none;
    border: none;
    color: currentColor;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
    font-size: 12px;
    margin-left: 8px;
}

.toast .toast-close:hover {
    opacity: 1;
}

.toast.fade-out {
    animation: toastFadeOut 0.3s ease-out forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastFadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}
