
/* =========================================
   Messenger Suite - Professional RTL Theme
   Font: Vazirmatn
========================================= */

@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-Medium.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-Bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    --primary: #5865e9;
    --primary-dark: #414dcc;
    --background: #f5f6fb;
    --surface: #ffffff;
    --sidebar: #171c35;
    --sidebar-hover: #282f50;
    --text: #20243a;
    --muted: #858ba2;
    --border: #e9eaf2;
    --success: #16a675;
    --danger: #e34f68;
    --warning: #e5a13b;
    --shadow: 0 8px 30px rgba(25, 32, 70, .055);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    direction: rtl;
    background: var(--background);
    color: var(--text);
    font-family: "Vazirmatn", Tahoma, sans-serif;
    font-size: 14px;
    line-height: 1.9;
}

/* Sidebar */

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 265px;
    padding: 25px 17px;
    background: var(--sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    box-shadow: -8px 0 30px rgba(0,0,0,.07);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 5px 9px 25px;
    border-bottom: 1px solid rgba(255,255,255,.09);
}

.brand b {
    display: block;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.brand small {
    display: block;
    color: #929bb8;
    font-size: 11px;
}

.brandmark {
    width: 45px;
    height: 45px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg,#6676ff,#8958dc);
    color: white;
    font-size: 21px;
    font-weight: 900;
    box-shadow: 0 7px 18px rgba(93,105,235,.3);
}

.sidebar nav {
    display: grid;
    gap: 7px;
    margin-top: 25px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 14px;
    border-radius: 11px;
    text-decoration: none;
    color: #aeb5d0;
    font-size: 13px;
    transition: .2s ease;
}

.sidebar nav a:hover {
    background: var(--sidebar-hover);
    color: white;
    transform: translateX(-2px);
}

.sidebar nav a.active {
    background: linear-gradient(100deg,#5968e9,#7259d6);
    color: white;
    box-shadow: 0 6px 18px rgba(87,101,225,.24);
}

.sidefoot {
    margin-top: auto;
    padding: 18px 12px 5px;
}

.sidefoot a {
    color: #ff9da9;
    text-decoration: none;
    font-size: 13px;
}

/* Main content */

.main {
    margin-right: 265px;
    padding: 35px 32px 45px;
    max-width: 1800px;
    min-height: 100vh;
}

/* Hide old page header.
   Keep notification and profile controls visible. */

.topbar {
    height: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: visible;
}

.topbar > div:first-child {
    display: none;
}

.topactions {
    position: fixed;
    top: 17px;
    left: 25px;
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 13px;
}

.userchip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 12px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: #e9ecff;
    color: var(--primary);
    font-weight: 700;
}

/* Notification bell */

.bellwrap {
    position: relative;
}

.bell {
    width: 43px;
    height: 43px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    color: var(--primary);
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: .2s;
}

.bell:hover {
    background: #f0f1ff;
    transform: translateY(-2px);
}

.bell i {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-style: normal;
    padding: 0 4px;
}

.notifs {
    display: none;
    position: absolute;
    left: 0;
    top: 53px;
    width: 320px;
    max-width: 90vw;
    max-height: 420px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 17px;
    box-shadow: 0 15px 50px rgba(20,25,60,.15);
    z-index: 200;
}

.notifs.show {
    display: block;
}

.notifs > b {
    display: block;
    margin-bottom: 10px;
}

.notifs p {
    padding: 9px 0;
    margin: 0;
    border-bottom: 1px solid var(--border);
}

.notifs small {
    display: block;
    color: var(--muted);
    font-size: 10px;
}

/* Dashboard statistics */

.stats {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 17px;
    margin: 35px 0 20px;
}

.stats article {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: .2s;
}

.stats article:hover {
    transform: translateY(-3px);
    box-shadow: 0 13px 35px rgba(25,32,70,.09);
}

.stats article small {
    color: var(--muted);
    font-size: 12px;
}

.stats article b {
    color: var(--primary);
    font-size: 30px;
    font-weight: 700;
    margin: 5px 0;
}

.stats article span {
    color: var(--muted);
    font-size: 11px;
}

/* Cards */

.card {
    padding: 23px;
    margin-bottom: 19px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card h3 {
    margin: 0 0 18px;
    font-size: 16px;
    font-weight: 700;
}

.card h4 {
    margin: 20px 0 10px;
    font-size: 13px;
}

.twocol {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.sectionhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sectionhead a {
    color: var(--primary);
    font-size: 12px;
    text-decoration: none;
}

/* Forms */

label {
    display: block;
    margin: 13px 0;
    font-weight: 600;
    font-size: 12px;
}

input,
textarea,
select {
    width: 100%;
    display: block;
    margin-top: 7px;
    padding: 11px 13px;
    border: 1px solid #e0e3ed;
    border-radius: 10px;
    background: #fafbfe;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    outline: none;
    transition: .2s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(88,101,233,.10);
}

textarea {
    resize: vertical;
}

.checkline,
.checks {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.checkline input,
.checks input {
    width: auto;
    display: inline-block;
}

.checks label {
    padding: 8px 13px;
    border-radius: 9px;
    background: #f2f3fa;
}

/* Buttons */

.primary,
.secondary,
.subtle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    border: 0;
    border-radius: 10px;
    padding: 10px 19px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: .2s;
}

.primary {
    color: white;
    background: linear-gradient(110deg,#5969e9,#7659d7);
    box-shadow: 0 5px 14px rgba(88,101,233,.2);
}

.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(88,101,233,.3);
}

.secondary {
    color: #4659bd;
    background: #edf0ff;
}

.secondary:hover {
    background: #e0e5ff;
}

.subtle {
    color: #626a82;
    background: #f0f1f6;
}

/* Tables */

.tablewrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th,
td {
    padding: 12px 13px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

th {
    color: #858ba2;
    background: #fafaff;
    font-size: 11px;
    font-weight: 700;
}

td {
    font-size: 12px;
}

tr:hover td {
    background: #fafaff;
}

/* Connections */

.connection,
.channelrow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 13px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

.connection small {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.platformicon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: #eef0ff;
    color: var(--primary);
}

.muted,
.stats span {
    color: var(--muted);
    font-size: 11px;
}

/* Alerts */

.alert {
    padding: 12px 16px;
    border-radius: 11px;
    margin: 18px 0;
    font-size: 12px;
}

.success {
    background: #e7f8f0;
    color: #167c54;
}

.error {
    background: #fff0f1;
    color: #b43e50;
}

/* Login */

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at 15% 20%,#e2e6ff,transparent 35%),
        radial-gradient(circle at 85% 80%,#e8e0ff,transparent 35%),
        #f5f6fb;
}

.loginbox {
    width: min(430px,94vw);
    padding: 38px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: white;
    box-shadow: 0 25px 80px rgba(30,35,80,.12);
}

.loginbox h1 {
    font-size: 22px;
}

.loginbox .primary {
    width: 100%;
    margin-top: 15px;
}

.err {
    color: var(--danger);
}

footer {
    padding: 25px;
    text-align: center;
    color: #a0a5b6;
    font-size: 10px;
}

/* Responsive */

@media(max-width:1100px) {
    .sidebar {
        width: 225px;
    }

    .main {
        margin-right: 225px;
        padding: 30px 20px;
    }

    .stats {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
}

@media(max-width:700px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        padding: 15px;
    }

    .sidebar nav {
        grid-template-columns: repeat(2,minmax(0,1fr));
        gap: 5px;
        margin-top: 15px;
    }

    .sidebar nav a {
        padding: 9px;
        font-size: 11px;
    }

    .sidefoot {
        padding-top: 12px;
    }

    .main {
        margin: 0;
        padding: 75px 12px 25px;
    }

    .topactions {
        top: 12px;
        left: 12px;
    }

    .userchip span:last-child {
        display: none;
    }

    .stats {
        grid-template-columns: repeat(2,minmax(0,1fr));
        gap: 9px;
        margin-top: 15px;
    }

    .stats article {
        padding: 14px;
    }

    .stats article b {
        font-size: 24px;
    }

    .twocol {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 15px;
    }

    .notifs {
        width: 280px;
    }
}

/* Dark mode foundation */

body.dark {
    --background: #111426;
    --surface: #1b2036;
    --text: #edf0ff;
    --muted: #9ba3bf;
    --border: #303650;
    --shadow: 0 8px 30px rgba(0,0,0,.15);
}

body.dark input,
body.dark textarea,
body.dark select {
    background: #222943;
    color: #fff;
    border-color: #39415f;
}

body.dark th,
body.dark tr:hover td {
    background: #222943;
}

body.dark .userchip,
body.dark .bell,
body.dark .notifs {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
