/* ==================================================
   MHDPlus - Panel Layout (Right Sidebar + Full-Width Content)
   ================================================== */

/* === متغیرهای پیش‌فرض (در صورت عدم بارگذاری از دیتابیس) === */
:root {
    --footer-bg: #16213e;
    --button-hover: #00a077;
    --sidebar-bg: #1e1e2d;
    --text-color: #ffffff;
    --border-light: #333;
    --title-color: #ffffff;
    --green: #00c896;
    --green-alert-bg: rgba(0, 200, 150, 0.2);
    --card-bg: rgba(30, 30, 45, 0.6);
    --text-light: #aaa;
    --dark: #0d1b2a;
}

/* === سایدبار راست === */
.panel-sidebar {
  position: fixed;
  top: 90px;
  right: 2rem;
  width: 280px;
  z-index: 1000;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 1.8rem;
  border: 1px solid var(--border-light);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  direction: rtl;
  font-family: 'Vazirmatn', sans-serif;
}

/* === محتوای اصلی === */
.panel-content {
  width: 100%;
  padding: 1.5rem 2rem 2rem 0;
  box-sizing: border-box;
  min-height: calc(100vh - 140px);
  direction: rtl;
  padding-right: calc(280px + 3rem);
}

/* === عنوان صفحه === */
.panel-content .page-title {
  margin-bottom: 1.8rem;
  text-align: right;
  font-size: 2rem;
  color: var(--title-color);
  position: relative;
  padding-bottom: 0.5rem;
}

/* === دکمه‌های یک‌رنگ — نسخه نهایی === */
.btn,
.btn-submit,
.btn-send-ticket,
.filters-bar button,
.file-btn,
.upload-btn,
a.btn,
button.btn,
.ticket-item a,
.ticket-item button {
  /*  background: var(--button-bg) !important; */
    color: white !important;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover,
.btn-submit:hover,
.filters-bar button:hover,
.file-btn:hover,
.upload-btn:hover,
a.btn:hover,
button.btn:hover,
.ticket-item a:hover,
.ticket-item button:hover {
    background: var(--button-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* === کارت‌ها === */
.panel-content .card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 0 1px var(--border-light);
  border: 1px solid var(--border-light);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.panel-content .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.panel-content .card h2 {
  color: var(--title-color);
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

/* === بکس آپلود === */
.upload-box {
  background: rgba(0, 0, 0, 0.2);
  border: 2px dashed var(--button-bg);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 2rem;
  transition: all 0.3s;
  direction: rtl;
}

.upload-box:hover {
  background: rgba(0, 0, 0, 0.3);
  border-color: var(--button-hover);
}

/* === گرید فایل‌ها === */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.8rem;
  margin-top: 1rem;
  width: 100%;
  justify-content: end;
}

.file-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.8rem;
  text-align: center;
  border: 1px solid var(--border-light);
  transition: all 0.3s;
  width: 100%;
  box-sizing: border-box;
  direction: rtl;
}

.file-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.file-icon {
  font-size: 2.2rem;
  margin-bottom: 1.2rem;
  color: var(--button-bg);
}

.file-name {
  color: white;
  font-weight: 600;
  margin-bottom: 0.8rem;
  word-break: break-word;
  font-size: 1.1rem;
}

.file-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-light);
  font-size: 0.9rem;
  margin: 1rem 0;
}

.file-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.2rem;
}

/* === آلرت‌ها === */
.alert {
  padding: 0.8rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  text-align: center;
  font-weight: 500;
  direction: rtl;
}

.alert-success {
  background: var(--green-alert-bg);
  color: var(--button-bg);
  border: 1px solid var(--border-light);
}

.alert-error {
  background: rgba(200, 50, 50, 0.15);
  color: #ff9999;
  border: 1px solid rgba(200, 50, 50, 0.3);
}

/* === تیکت‌ها === */
.tickets-container {
  max-width: 1000px;
  margin: 0 auto;
}

.ticket-section {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 25px;
  border: 1px solid var(--border-light);
}

.ticket-section h3 {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--button-bg);
  color: var(--button-bg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 600;
  direction: rtl;
}

.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.filters-bar label {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-right: 8px;
}

.filters-bar input,
.filters-bar select {
  padding: 0.65rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text);
  font-family: Vazirmatn, sans-serif;
  font-size: 0.95rem;
  direction: rtl;
  text-align: right;
  min-width: 160px;
}

.status-badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.status-open { background: var(--green-alert-bg); color: var(--button-bg); }
.status-in-progress { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.status-closed { background: rgba(244, 67, 54, 0.2); color: #f44336; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.2s;
}

.pagination a:hover {
  background: var(--button-bg);
  color: white;
}

.pagination .current {
  background: var(--button-bg);
  color: white;
  font-weight: bold;
}

/* === واکنش‌گرا === */
@media (max-width: 992px) {
  .panel-sidebar { display: none !important; }
  .panel-content { padding: 1.5rem; padding-right: 0 !important; }
  .files-grid { grid-template-columns: 1fr; }
  .file-actions { flex-direction: column; }
  .file-btn { width: 100%; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filters-bar .filter-group { width: 100%; }
  .filters-bar input, .filters-bar select { min-width: 100%; }
}
/* === استایل گفت‌وگوی تیکت (پیام‌های جداگانه) === */
.ticket-reply-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
}

.sent-by-user {
    border-left: 4px solid var(--button-bg);
}

.sent-by-admin {
    border-right: 4px solid var(--button-bg);
}

.ticket-reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
    color: var(--title-color);
}

.ticket-reply-time {
    color: var(--text-light);
    font-style: italic;
}

.ticket-reply-body {
    color: var(--text-color);
    line-height: 1.6;
    white-space: pre-wrap;
}

.ticket-reply-attachment {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed var(--border-light);
}