/* =========================================================================
 * Slackr — modern theme overrides
 * Loaded after provided.css. Styling only: no required IDs/classes changed.
 * ========================================================================= */

:root {
    --brand:        #4f46e5;   /* indigo  */
    --brand-dark:   #4338ca;
    --brand-light:  #eef2ff;
    --accent:       #06b6d4;   /* cyan    */
    --sidebar-bg:   #1e1b2e;   /* deep aubergine */
    --sidebar-bg-2: #2a2540;
    --sidebar-hover:#352f4d;
    --text:         #1f2933;
    --text-muted:   #6b7280;
    --surface:      #ffffff;
    --bg:           #f4f5fb;
    --border:       #e6e8f0;
    --danger:       #ef4444;
    --success:      #16a34a;
    --radius:       12px;
    --radius-sm:    8px;
    --shadow-sm:    0 1px 3px rgba(16, 24, 40, .08);
    --shadow-md:    0 6px 18px rgba(16, 24, 40, .10);
    --shadow-lg:    0 20px 45px rgba(16, 24, 40, .18);
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Header / banner ---------- */
.banner {
    background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 50%, var(--accent) 130%);
    box-shadow: var(--shadow-sm);
    padding: 0.85rem 1.25rem;
    letter-spacing: .3px;
}
.banner h1 {
    font-weight: 700;
    font-size: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.banner h1::before {
    content: "💬";
    font-size: 1.4rem;
}

footer {
    color: var(--text-muted);
    font-size: .85rem;
}

/* ---------- Auth cards (login / register) ---------- */
#login-container, #register-container {
    min-height: calc(100vh - 200px);
}
#login-form, #register-form {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem 2.25rem;
    /* showLogin() forces the container to display:block (inline style), which
       defeats the flex centering — so centre the card itself with auto margins. */
    width: 400px;
    max-width: 90%;
    margin: 2.5rem auto;
}
#login-form h2, #register-form h2 {
    font-weight: 700;
    letter-spacing: -.01em;
}
.form-group input,
.create-channel-popup-body textarea,
.channel-edit-section input,
.channel-edit-section textarea {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .18);
}
#login-submit, #register-submit {
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: transform .08s ease, background-color .15s, box-shadow .15s;
    box-shadow: var(--shadow-sm);
}
#login-submit { background: var(--brand); }
#login-submit:hover { background: var(--brand-dark); }
#register-submit { background: var(--success); }
#login-submit:active, #register-submit:active { transform: translateY(1px); }
.form-links a { color: var(--brand); font-weight: 500; }

/* ---------- App layout ---------- */
.app-layout {
    gap: 0;
    padding: 0;
}

/* ---------- Sidebar ---------- */
.sidebar {
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    width: 280px;
}
.sidebar-header {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    padding: 1.1rem 1.25rem;
}
.sidebar-header h3 {
    font-weight: 700;
    font-size: 1.15rem;
}
.user-profile-section { display: flex; align-items: center; gap: .5rem; }
#avatar-image.avatar-clickable {
    border: 2px solid rgba(255, 255, 255, .35);
    object-fit: cover;
    cursor: pointer;
    transition: border-color .15s, transform .15s;
}
#avatar-image.avatar-clickable:hover {
    border-color: var(--accent);
    transform: scale(1.06);
}
#logout-button {
    border-radius: 999px;
    border-color: rgba(255, 255, 255, .3);
    color: #fff;
    font-weight: 500;
}
#logout-button:hover {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .5);
    color: #fff;
}
.channel-section-title {
    color: #9aa0b4;
    font-size: .72rem;
    letter-spacing: 1px;
}
.channel-container {
    margin: 2px 10px;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    width: auto;
    color: #cdd1e0;
    border-left: none;
}
.channel-public, .channel-private { border-left: none; }
.channel-container:hover { background: var(--sidebar-hover); color: #fff; }
.channel-container.active {
    background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.channel-icon { opacity: .85; }
.channel-private > .channel-icon { color: #fbbf24; }

/* ---------- Main content ---------- */
.main-content { background: var(--bg); }
.dashboard-welcome h2 {
    font-weight: 800;
    background: linear-gradient(135deg, var(--brand), #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.create-channel-btn {
    background: var(--brand);
    border-radius: 999px;
    box-shadow: var(--shadow-md);
    transition: transform .08s ease, background-color .15s;
}
.create-channel-btn:hover { background: var(--brand-dark); }
.create-channel-btn:active { transform: translateY(1px); }

/* ---------- Channel header ---------- */
.channel-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.channel-header h2 { font-weight: 700; }
.channel-header h2::before { content: "# "; color: var(--text-muted); }
.channel-actions .btn,
.channel-actions .btn-secondary { border-radius: 999px; font-size: .85rem; }

/* ---------- Messages ---------- */
#channel-messages { background: var(--bg); padding: 1.25rem 1.5rem; }

.message-container.card {
    border: none;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, transform .08s;
}
.message-container.card:hover { box-shadow: var(--shadow-md); }
.message-container .card-body { padding: .85rem 1rem; }
.message-container img.rounded-circle {
    border: 1px solid var(--border);
    object-fit: cover;
}
.message-user-name {
    color: var(--text);
    transition: color .12s;
}
.message-user-name:hover { color: var(--brand); text-decoration: underline; }
.message-content p { color: #374151; line-height: 1.5; }
.message-image.img-thumbnail {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: transform .12s;
}
.message-image.img-thumbnail:hover { transform: scale(1.02); }

/* Reactions as pills */
.reaction-count-btn {
    border-radius: 999px !important;
    padding: .15rem .6rem;
    font-size: .85rem;
    line-height: 1.4;
}
.reaction-count-btn.active {
    background: var(--brand-light) !important;
    border-color: var(--brand) !important;
    color: var(--brand-dark) !important;
}
.reaction-buttons .dropdown-toggle {
    border-radius: 999px;
    font-size: .8rem;
    padding: .15rem .65rem;
}

/* ---------- Fixed message input bar ---------- */
#message-input-area {
    background: var(--surface) !important;
    border-top: 1px solid var(--border) !important;
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
    z-index: 200;
}
#message-input {
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: .6rem 1.1rem;
}
#message-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
#message-send-button {
    border-radius: 999px;
    background: var(--brand);
    border-color: var(--brand);
    font-weight: 600;
    padding-left: 1.4rem;
    padding-right: 1.4rem;
}
#message-send-button:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
#image-upload-button { border-radius: 999px; }

/* ---------- Channel details side panel ---------- */
.channel-details { border-radius: 0; box-shadow: var(--shadow-lg); }
.channel-details-header { background: var(--surface); }
.info-item label { color: var(--text); }

/* ---------- Buttons (shared custom classes) ---------- */
.btn-primary { background: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); }

/* ---------- Modals (Bootstrap) ---------- */
.modal-content { border: none; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }
#profile-image, #own-profile-image { border: 3px solid var(--brand-light); object-fit: cover; }

/* ---------- Error / success popups ---------- */
.error-popup-content { border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.error-popup-header { border-radius: var(--radius) var(--radius) 0 0; }
#success-popup .error-popup-header h3 { color: var(--success); }

/* =========================================================================
 * In-app notification toasts (push notifications)
 * ========================================================================= */
#notification-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    max-width: 340px;
}
.app-toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: .75rem .95rem;
    cursor: pointer;
    opacity: 0;
    transform: translateX(120%);
    transition: opacity .3s ease, transform .3s ease;
}
.app-toast.show { opacity: 1; transform: translateX(0); }
.app-toast:hover { box-shadow: var(--shadow-lg); }
.app-toast-title { font-weight: 700; font-size: .92rem; color: var(--text); }
.app-toast-body { font-size: .85rem; color: var(--text-muted); margin-top: .15rem; }

/* =========================================================================
 * Offline banner
 * ========================================================================= */
#offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2500;
    background: #b45309;
    color: #fff;
    text-align: center;
    font-size: .9rem;
    font-weight: 600;
    padding: .5rem 1rem;
    box-shadow: var(--shadow-md);
}

/* ---------- Scrollbars ---------- */
.channel-list::-webkit-scrollbar,
#channel-messages::-webkit-scrollbar { width: 8px; }
.channel-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 8px; }
#channel-messages::-webkit-scrollbar-thumb { background: rgba(16,24,40,.18); border-radius: 8px; }

/* ---------- Small screens ---------- */
@media (max-width: 768px) {
    .sidebar { width: 100%; }
    #notification-toast-container { left: 1rem; right: 1rem; max-width: none; }
}
