@import url('https://cdn.jsdelivr.net/npm/vazirmatn@33.0.3/Vazirmatn-font-face.css');

:root{
  --font:'Vazirmatn',Tahoma,sans-serif;
  --bg:#f5f7fb;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --primary:#2563eb;
  --primary-2:#1d4ed8;
  --success:#10b981;
  --danger:#ef4444;
  --warning:#f59e0b;
  --info:#06b6d4;
  --radius:18px;
  --shadow:0 12px 35px rgba(15,23,42,.08);
  --shadow-soft:0 8px 20px rgba(15,23,42,.06);
}

*{
  box-sizing:border-box;
}

html{
  direction:rtl;
  font-family:var(--font);
}

body{
  margin:0;
  background:
    radial-gradient(circle at top right,rgba(37,99,235,.13),transparent 35%),
    linear-gradient(180deg,#f8fbff 0%,#f3f5f9 100%);
  color:var(--text);
  font-family:var(--font);
  font-size:14px;
  min-height:100vh;
}

a{
  color:inherit;
  text-decoration:none;
}

img{
  max-width:100%;
}

.app,
.dashboard{
  display:flex;
  min-height:100vh;
}

/* Sidebar */

.sidebar{
  width:280px;
  background:linear-gradient(180deg,#0f172a 0%,#111827 100%);
  color:#fff;
  padding:22px 16px;
  position:fixed;
  right:0;
  top:0;
  bottom:0;
  overflow-y:auto;
  box-shadow:-10px 0 30px rgba(15,23,42,.16);
  z-index:20;
}

.sidebar .brand,
.logo{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px 24px;
  font-weight:900;
  font-size:20px;
}

.sidebar .brand:before,
.logo:before{
  content:'';
  width:42px;
  height:42px;
  border-radius:14px;
  background:linear-gradient(135deg,#3b82f6,#06b6d4);
  box-shadow:0 10px 25px rgba(59,130,246,.4);
}

.sidebar nav,
.sidebar-menu{
  display:flex;
  flex-direction:column;
  gap:7px;
}

.sidebar a,
.sidebar-menu a,
.nav-link{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 14px;
  border-radius:14px;
  color:#cbd5e1;
  transition:.2s;
  font-weight:600;
}

.sidebar a:hover,
.sidebar a.active,
.sidebar-menu a:hover,
.sidebar-menu a.active,
.nav-link.active{
  background:rgba(255,255,255,.1);
  color:#fff;
  transform:translateX(-3px);
}

/* Main */

.main,
.content,
.main-content{
  width:calc(100% - 280px);
  margin-right:280px;
  padding:26px;
}

.topbar,
.header{
  min-height:76px;
  background:rgba(255,255,255,.78);
  backdrop-filter:blur(16px);
  border:1px solid rgba(229,231,235,.85);
  border-radius:24px;
  box-shadow:var(--shadow-soft);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 22px;
  margin-bottom:24px;
}

.page-title h1,
.header h1{
  margin:0 0 6px;
  font-size:24px;
  font-weight:900;
}

.page-title p,
.header p{
  margin:0;
  color:var(--muted);
}

/* Cards */

.card,
.panel,
.box,
.widget{
  background:rgba(255,255,255,.9);
  border:1px solid rgba(229,231,235,.9);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:22px;
  margin-bottom:20px;
}

.card-title{
  font-size:17px;
  font-weight:900;
  margin-bottom:16px;
}

.grid,
.stats-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:18px;
}

.stat-card{
  position:relative;
  overflow:hidden;
  padding:22px;
  border-radius:22px;
  background:linear-gradient(145deg,#fff,#f8fafc);
  border:1px solid var(--border);
  box-shadow:var(--shadow-soft);
}

.stat-card:after{
  content:'';
  position:absolute;
  left:-35px;
  top:-35px;
  width:110px;
  height:110px;
  background:rgba(37,99,235,.09);
  border-radius:50%;
}

.stat-card .label{
  color:var(--muted);
  font-weight:600;
}

.stat-card .value{
  font-size:27px;
  font-weight:900;
  margin-top:10px;
}

/* Forms */

form{
  margin:0;
}

.form-group{
  margin-bottom:16px;
}

label{
  display:block;
  margin-bottom:8px;
  font-weight:800;
  color:#374151;
}

input,
select,
textarea{
  width:100%;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  border-radius:14px;
  padding:12px 14px;
  font-family:var(--font);
  font-size:14px;
  outline:none;
  transition:.2s;
}

textarea{
  min-height:130px;
  resize:vertical;
}

input:focus,
select:focus,
textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 4px rgba(37,99,235,.12);
}

/* Buttons */

.btn,
button,
input[type="submit"]{
  border:0;
  border-radius:14px;
  padding:11px 18px;
  font-family:var(--font);
  font-weight:800;
  cursor:pointer;
  transition:.2s;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

.btn-primary,
button[type="submit"],
input[type="submit"]{
  background:linear-gradient(135deg,var(--primary),var(--primary-2));
  color:#fff;
  box-shadow:0 10px 22px rgba(37,99,235,.25);
}

.btn-primary:hover,
button[type="submit"]:hover{
  transform:translateY(-2px);
  box-shadow:0 14px 28px rgba(37,99,235,.32);
}

.btn-secondary{
  background:#eef2ff;
  color:#1d4ed8;
}

.btn-danger{
  background:#fee2e2;
  color:#b91c1c;
}

.btn-success{
  background:#dcfce7;
  color:#047857;
}

/* Tables */

.table-responsive{
  width:100%;
  overflow-x:auto;
}

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0 10px;
}

thead th{
  text-align:right;
  color:#64748b;
  font-size:13px;
  font-weight:900;
  padding:0 14px 8px;
}

tbody tr{
  background:#fff;
  box-shadow:var(--shadow-soft);
}

tbody td{
  padding:15px 14px;
  border-top:1px solid var(--border);
  border-bottom:1px solid var(--border);
}

tbody td:first-child{
  border-radius:0 14px 14px 0;
  border-right:1px solid var(--border);
}

tbody td:last-child{
  border-radius:14px 0 0 14px;
  border-left:1px solid var(--border);
}

/* Badges */

.badge,
.status{
  display:inline-flex;
  align-items:center;
  padding:6px 11px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
}

.badge-success,
.status-success,
.status-sent{
  background:#dcfce7;
  color:#047857;
}

.badge-danger,
.status-danger,
.status-failed{
  background:#fee2e2;
  color:#b91c1c;
}

.badge-warning,
.status-warning,
.status-pending{
  background:#fef3c7;
  color:#92400e;
}

.badge-info{
  background:#cffafe;
  color:#0e7490;
}

/* Login / Auth */

.auth-page{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
  background:
    radial-gradient(circle at 20% 20%,rgba(37,99,235,.2),transparent 30%),
    radial-gradient(circle at 80% 80%,rgba(6,182,212,.18),transparent 30%),
    linear-gradient(135deg,#eff6ff,#f8fafc);
}

.auth-card{
  width:100%;
  max-width:440px;
  background:rgba(255,255,255,.88);
  backdrop-filter:blur(18px);
  border:1px solid rgba(255,255,255,.7);
  border-radius:28px;
  box-shadow:0 25px 70px rgba(15,23,42,.16);
  padding:34px;
}

.auth-card h1{
  margin:0 0 8px;
  font-size:26px;
  font-weight:900;
}

.auth-card p{
  color:var(--muted);
  margin-bottom:24px;
}

/* Alerts */

.alert{
  border-radius:16px;
  padding:13px 15px;
  margin-bottom:16px;
  font-weight:700;
}

.alert-success{
  background:#ecfdf5;
  color:#047857;
  border:1px solid #a7f3d0;
}

.alert-danger{
  background:#fef2f2;
  color:#b91c1c;
  border:1px solid #fecaca;
}

.alert-warning{
  background:#fffbeb;
  color:#92400e;
  border:1px solid #fde68a;
}

/* Campaign / Message Composer */

.composer{
  display:grid;
  grid-template-columns:1.3fr .7fr;
  gap:20px;
}

.message-preview{
  background:linear-gradient(180deg,#eff6ff,#fff);
  border:1px dashed #93c5fd;
  border-radius:22px;
  padding:20px;
}

.phone-frame{
  max-width:310px;
  margin:auto;
  background:#0f172a;
  border-radius:36px;
  padding:14px;
  box-shadow:0 20px 50px rgba(15,23,42,.25);
}

.phone-screen{
  background:#f8fafc;
  border-radius:26px;
  min-height:420px;
  padding:18px;
}

.chat-bubble{
  background:#2563eb;
  color:#fff;
  padding:12px 14px;
  border-radius:18px 18px 4px 18px;
  line-height:1.9;
}

/* Utilities */

.flex{
  display:flex;
}

.items-center{
  align-items:center;
}

.justify-between{
  justify-content:space-between;
}

.gap-2{
  gap:8px;
}

.gap-3{
  gap:12px;
}

.text-muted{
  color:var(--muted);
}

.text-center{
  text-align:center;
}

.mt-2{
  margin-top:8px;
}

.mt-3{
  margin-top:12px;
}

.mt-4{
  margin-top:16px;
}

/* Mobile */

@media(max-width:1100px){
  .grid,
  .stats-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .composer{
    grid-template-columns:1fr;
  }
}

@media(max-width:768px){
  .sidebar{
    position:relative;
    width:100%;
    height:auto;
    border-radius:0 0 24px 24px;
  }

  .app,
  .dashboard{
    display:block;
  }

  .main,
  .content,
  .main-content{
    width:100%;
    margin-right:0;
    padding:16px;
  }

  .topbar,
  .header{
    flex-direction:column;
    align-items:flex-start;
    gap:12px;
    border-radius:18px;
  }

  .grid,
  .stats-grid{
    grid-template-columns:1fr;
  }

  .auth-card{
    padding:24px;
  }
}

/* =========================================================
   Bale SaaS Pro UI Upgrade
   Append this block to the END of app.css
========================================================= */

/* ---------- Global Polish ---------- */

body{
  overflow-x:hidden;
}

::selection{
  background:rgba(37,99,235,.18);
  color:#0f172a;
}

.container,
.page-container{
  width:100%;
  max-width:1280px;
  margin:0 auto;
}

/* ---------- Auth / Login / Register Fix ---------- */

.auth-page,
.login-page,
.register-page,
.auth-wrapper{
  min-height:100vh !important;
  width:100%;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:32px !important;
  background:
    radial-gradient(circle at 15% 20%,rgba(37,99,235,.16),transparent 28%),
    radial-gradient(circle at 85% 75%,rgba(6,182,212,.18),transparent 30%),
    linear-gradient(135deg,#f8fbff 0%,#eef4ff 100%) !important;
}

.auth-card,
.login-card,
.register-card,
.auth-box{
  width:100% !important;
  max-width:460px !important;
  margin:0 auto !important;
  position:relative;
  right:auto !important;
  left:auto !important;
  top:auto !important;
  transform:none !important;
  background:rgba(255,255,255,.88) !important;
  backdrop-filter:blur(22px);
  border:1px solid rgba(255,255,255,.82);
  border-radius:32px !important;
  box-shadow:
    0 30px 90px rgba(15,23,42,.16),
    inset 0 1px 0 rgba(255,255,255,.6) !important;
  padding:38px !important;
}

.auth-card::before,
.login-card::before,
.register-card::before,
.auth-box::before{
  content:'';
  display:block;
  width:48px;
  height:48px;
  border-radius:16px;
  margin:0 0 18px auto;
  background:linear-gradient(135deg,#2563eb,#06b6d4);
  box-shadow:0 14px 30px rgba(37,99,235,.35);
}

.auth-card h1,
.login-card h1,
.register-card h1,
.auth-box h1{
  font-size:28px !important;
  font-weight:950 !important;
  letter-spacing:-.7px;
  margin-bottom:10px !important;
  color:#0f172a;
}

.auth-card p,
.login-card p,
.register-card p,
.auth-box p{
  color:#64748b;
  line-height:1.9;
}

.auth-card input,
.login-card input,
.register-card input,
.auth-box input{
  height:52px;
  background:#f8fafc;
  border:1px solid #dbe3ef;
  border-radius:16px;
  font-weight:700;
}

.auth-card input:focus,
.login-card input:focus,
.register-card input:focus,
.auth-box input:focus{
  background:#fff;
  border-color:#2563eb;
  box-shadow:0 0 0 5px rgba(37,99,235,.12);
}

.auth-card button,
.login-card button,
.register-card button,
.auth-box button,
.auth-card .btn,
.login-card .btn,
.register-card .btn,
.auth-box .btn{
  min-height:50px;
  border-radius:16px;
}

.auth-card a,
.login-card a,
.register-card a,
.auth-box a{
  color:#2563eb;
  font-weight:800;
}

/* ---------- Dashboard Header Polish ---------- */

.topbar,
.header{
  background:
    linear-gradient(135deg,rgba(255,255,255,.92),rgba(248,250,252,.78)) !important;
  border:1px solid rgba(226,232,240,.95);
  box-shadow:
    0 16px 40px rgba(15,23,42,.07),
    inset 0 1px 0 rgba(255,255,255,.75);
}

.page-title h1,
.header h1{
  font-size:30px !important;
  letter-spacing:-1px;
}

.page-title p,
.header p{
  font-size:14px;
  font-weight:600;
}

/* ---------- Dashboard Stats Fix ---------- */

.stats-grid,
.grid.stats-grid,
.dashboard-stats,
.stats,
.summary-cards{
  display:grid !important;
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  gap:20px !important;
  margin:22px 0 26px !important;
}

/* پشتیبانی از کلاس‌های مختلف کارت آمار */
.stat-card,
.stat,
.summary-card,
.balance-card,
.campaign-card,
.message-card{
  min-height:150px;
  position:relative;
  overflow:hidden;
  padding:24px !important;
  border-radius:26px !important;
  border:1px solid rgba(255,255,255,.55) !important;
  color:#fff;
  box-shadow:
    0 18px 45px rgba(15,23,42,.13),
    inset 0 1px 0 rgba(255,255,255,.26) !important;
  display:flex !important;
  flex-direction:column;
  align-items:flex-start;
  justify-content:space-between;
  isolation:isolate;
  transition:.25s ease;
}

.stat-card:hover,
.stat:hover,
.summary-card:hover,
.balance-card:hover,
.campaign-card:hover,
.message-card:hover{
  transform:translateY(-5px);
  box-shadow:
    0 24px 60px rgba(15,23,42,.18),
    inset 0 1px 0 rgba(255,255,255,.32) !important;
}

/* اگر کارت‌ها کلاس خاص ندارند، با ترتیب رنگ می‌گیرند */
.stats-grid .stat-card:nth-child(1),
.stats .stat:nth-child(1),
.summary-cards .summary-card:nth-child(1),
.balance-card{
  background:
    radial-gradient(circle at left top,rgba(255,255,255,.28),transparent 32%),
    linear-gradient(135deg,#2563eb 0%,#1d4ed8 48%,#172554 100%) !important;
}

.stats-grid .stat-card:nth-child(2),
.stats .stat:nth-child(2),
.summary-cards .summary-card:nth-child(2),
.campaign-card{
  background:
    radial-gradient(circle at left top,rgba(255,255,255,.28),transparent 32%),
    linear-gradient(135deg,#10b981 0%,#059669 50%,#064e3b 100%) !important;
}

.stats-grid .stat-card:nth-child(3),
.stats .stat:nth-child(3),
.summary-cards .summary-card:nth-child(3),
.message-card{
  background:
    radial-gradient(circle at left top,rgba(255,255,255,.28),transparent 32%),
    linear-gradient(135deg,#8b5cf6 0%,#6d28d9 50%,#3b0764 100%) !important;
}

.stat-card:nth-child(4){
  background:
    radial-gradient(circle at left top,rgba(255,255,255,.28),transparent 32%),
    linear-gradient(135deg,#f59e0b 0%,#d97706 50%,#78350f 100%) !important;
}

.stat-card::before,
.stat::before,
.summary-card::before,
.balance-card::before,
.campaign-card::before,
.message-card::before{
  content:'';
  position:absolute;
  left:-34px;
  top:-34px;
  width:130px;
  height:130px;
  border-radius:999px;
  background:rgba(255,255,255,.18);
  z-index:-1;
}

.stat-card::after,
.stat::after,
.summary-card::after,
.balance-card::after,
.campaign-card::after,
.message-card::after{
  content:'';
  position:absolute;
  left:24px;
  bottom:22px;
  width:54px;
  height:54px;
  border-radius:18px;
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.22);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.22);
}

/* عنوان آمار */
.stat-card .label,
.stat .label,
.summary-card .label,
.balance-card .label,
.campaign-card .label,
.message-card .label,
.stat-card span,
.stat span,
.summary-card span{
  color:rgba(255,255,255,.82) !important;
  font-size:14px !important;
  font-weight:800 !important;
  margin:0 !important;
}

/* عدد آمار */
.stat-card .value,
.stat .value,
.summary-card .value,
.balance-card .value,
.campaign-card .value,
.message-card .value,
.stat-card h3,
.stat h3,
.summary-card h3,
.balance-card h3,
.campaign-card h3,
.message-card h3{
  color:#fff !important;
  font-size:32px !important;
  line-height:1.2;
  font-weight:950 !important;
  letter-spacing:-1px;
  margin:14px 0 0 !important;
  text-shadow:0 8px 22px rgba(15,23,42,.18);
}

/* برای حالتی که موجودی با متن ساده داخل صفحه آمده */
.balance,
.wallet-balance,
.total-balance{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 16px;
  background:#eff6ff;
  color:#1d4ed8;
  border:1px solid #bfdbfe;
  border-radius:999px;
  font-weight:950;
}

/* ---------- Dashboard Content ---------- */

.card,
.panel,
.box,
.widget{
  border-radius:26px !important;
  background:rgba(255,255,255,.92) !important;
  border:1px solid rgba(226,232,240,.95) !important;
  box-shadow:
    0 18px 50px rgba(15,23,42,.08),
    inset 0 1px 0 rgba(255,255,255,.72) !important;
}

.card-title,
.panel-title,
.widget-title{
  font-size:20px !important;
  font-weight:950 !important;
  color:#0f172a;
}

/* ---------- Better Tables ---------- */

.table-responsive{
  border-radius:22px;
}

table{
  border-spacing:0 12px !important;
}

thead th{
  background:#f8fafc;
  padding:14px 16px !important;
  color:#475569 !important;
}

thead th:first-child{
  border-radius:0 14px 14px 0;
}

thead th:last-child{
  border-radius:14px 0 0 14px;
}

tbody tr{
  transition:.18s ease;
}

tbody tr:hover{
  transform:scale(1.005);
}

tbody td{
  font-weight:700;
}

/* ---------- Sidebar Better ---------- */

.sidebar{
  background:
    radial-gradient(circle at 0 0,rgba(37,99,235,.28),transparent 28%),
    linear-gradient(180deg,#0f172a 0%,#020617 100%) !important;
}

.sidebar .brand,
.logo{
  font-size:22px !important;
  letter-spacing:-.6px;
}

.sidebar a,
.sidebar-menu a,
.nav-link{
  min-height:46px;
  color:#cbd5e1 !important;
}

.sidebar a:hover,
.sidebar a.active,
.sidebar-menu a:hover,
.sidebar-menu a.active,
.nav-link.active{
  background:linear-gradient(135deg,rgba(37,99,235,.24),rgba(6,182,212,.12)) !important;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);
}

/* ---------- Mobile Responsive Menu ---------- */

.menu-btn,
.mobile-menu-btn,
.nav-toggle{
  display:none;
}

.mobile-overlay{
  display:none;
}

@media(max-width:768px){

  body{
    background:#f4f7fb;
  }

  .menu-btn,
  .mobile-menu-btn,
  .nav-toggle{
    display:flex !important;
    position:fixed;
    top:14px;
    left:14px;
    z-index:1001;
    width:46px;
    height:46px;
    align-items:center;
    justify-content:center;
    border-radius:16px;
    background:linear-gradient(135deg,#2563eb,#06b6d4) !important;
    color:#fff !important;
    box-shadow:0 14px 30px rgba(37,99,235,.28);
  }

  .sidebar{
    position:fixed !important;
    top:0 !important;
    right:-290px !important;
    width:280px !important;
    height:100vh !important;
    border-radius:0 !important;
    z-index:1000 !important;
    transition:.28s ease !important;
  }

  .sidebar.active,
  .sidebar.open,
  body.menu-open .sidebar{
    right:0 !important;
  }

  .main,
  .content,
  .main-content{
    width:100% !important;
    margin-right:0 !important;
    padding:76px 14px 18px !important;
  }

  .topbar,
  .header{
    border-radius:22px !important;
    padding:18px !important;
  }

  .page-title h1,
  .header h1{
    font-size:24px !important;
  }

  .stats-grid,
  .grid.stats-grid,
  .dashboard-stats,
  .stats,
  .summary-cards{
    grid-template-columns:1fr !important;
    gap:14px !important;
  }

  .stat-card,
  .stat,
  .summary-card,
  .balance-card,
  .campaign-card,
  .message-card{
    min-height:132px;
    border-radius:22px !important;
  }

  .stat-card .value,
  .stat .value,
  .summary-card .value,
  .balance-card .value,
  .campaign-card .value,
  .message-card .value,
  .stat-card h3,
  .stat h3,
  .summary-card h3{
    font-size:28px !important;
  }

  .card,
  .panel,
  .box,
  .widget{
    padding:18px !important;
    border-radius:22px !important;
  }

  .auth-page,
  .login-page,
  .register-page,
  .auth-wrapper{
    padding:18px !important;
  }

  .auth-card,
  .login-card,
  .register-card,
  .auth-box{
    max-width:100% !important;
    padding:26px !important;
    border-radius:26px !important;
  }
}
.stat-card, .stat, .summary-card, .balance-card, .campaign-card, .message-card {
    background: #00187bd4;
}
.ticket-message{
  max-width:75%;
  margin:12px 0;
  padding:14px 16px;
  border-radius:18px;
  line-height:1.9;
}

.ticket-message small{
  display:block;
  margin-top:8px;
  opacity:.75;
}

.ticket-user{
  margin-right:auto;
  background:#2563eb;
  color:#fff;
  border-bottom-left-radius:6px;
}

.ticket-admin{
  margin-left:auto;
  background:#f1f5f9;
  color:#0f172a;
  border:1px solid #e2e8f0;
  border-bottom-right-radius:6px;
}
.menu-btn{
  display:none;
  position:fixed;
  top:15px;
  left:15px;
  z-index:999;
  background:#2563eb;
  color:#fff;
  border:none;
  border-radius:10px;
  padding:10px 12px;
}

@media(max-width:768px){

  .menu-btn{
    display:block;
  }

  .sidebar{
    position:fixed;
    right:-100%;
    top:0;
    width:260px;
    height:100%;
    transition:.3s;
  }

  .sidebar.active{
    right:0;
  }

  .main{
    margin-right:0;
    width:100%;
  }

}
@media(max-width:768px){

  .stats-grid{
    grid-template-columns:1fr;
  }

  .auth-container{
    grid-template-columns:1fr;
  }

  .auth-visual{
    display:none;
  }

}