/* =============================================
   استایل اصلی سیستم تیکتینگ نودسرو
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #1a56db;
    --primary-dark: #0f3fa0;
    --primary-light: #e8f0fe;
    --secondary: #0ea5e9;
    --accent: #6366f1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --dark-2: #1e293b;
    --dark-3: #334155;
    --gray: #64748b;
    --gray-light: #94a3b8;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    direction: rtl;
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--dark);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.7;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--dark);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.navbar-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: white;
    box-shadow: 0 0 15px rgba(26,86,219,0.4);
}

.navbar-name {
    font-size: 18px;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
}

.navbar-name span {
    color: var(--secondary);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link {
    color: #94a3b8;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover, .nav-link.active {
    color: white;
    background: rgba(255,255,255,0.08);
}

.nav-btn {
    background: var(--primary);
    color: white !important;
    padding: 8px 18px !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 600 !important;
}

.nav-btn:hover {
    background: var(--primary-dark) !important;
}

/* ===== HERO / AUTH PAGES ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    background: var(--dark);
}

.auth-left {
    flex: 1;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f3fa0 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    position: relative;
    overflow: hidden;
}

.auth-left::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(26,86,219,0.3) 0%, transparent 70%);
    top: -100px;
    right: -100px;
}

.auth-left::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14,165,233,0.2) 0%, transparent 70%);
    bottom: -50px;
    left: 50px;
}

.auth-logo-big {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 900;
    color: white;
    margin-bottom: 24px;
    box-shadow: 0 0 40px rgba(26,86,219,0.5);
    position: relative;
    z-index: 1;
}

.auth-title-big {
    font-size: 32px;
    font-weight: 800;
    color: white;
    text-align: center;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.auth-subtitle {
    color: #94a3b8;
    text-align: center;
    font-size: 15px;
    max-width: 300px;
    position: relative;
    z-index: 1;
}

.auth-features {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cbd5e1;
    font-size: 14px;
}

.auth-feature-icon {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.auth-right {
    width: 460px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
}

.auth-form-container {
    width: 100%;
    max-width: 360px;
}

.auth-form-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 6px;
}

.auth-form-sub {
    color: var(--gray);
    font-size: 13px;
    margin-bottom: 32px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark-3);
    margin-bottom: 7px;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 14px;
    color: var(--dark);
    background: var(--white);
    transition: all 0.2s;
    direction: rtl;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

.form-control::placeholder {
    color: #b0bec5;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26,86,219,0.3);
}

.btn-secondary {
    background: var(--bg);
    color: var(--dark-3);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 13px 28px;
    font-size: 15px;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
}

/* ===== ALERTS ===== */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid #bfdbfe;
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard {
    display: flex;
    min-height: calc(100vh - 64px);
}

.sidebar {
    width: 250px;
    background: var(--dark);
    padding: 20px 0;
    flex-shrink: 0;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
}

.sidebar-section {
    padding: 6px 12px;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 8px 0 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 0;
    position: relative;
}

.sidebar-item:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}

.sidebar-item.active {
    color: white;
    background: rgba(26,86,219,0.2);
}

.sidebar-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-icon {
    font-size: 17px;
    width: 20px;
    text-align: center;
}

.badge-count {
    margin-right: auto;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    min-width: 22px;
    text-align: center;
}

.main-content {
    flex: 1;
    padding: 28px;
    max-width: calc(100% - 250px);
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--dark);
}

.page-title span {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--gray);
    margin-top: 2px;
}

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue { background: #eff6ff; }
.stat-icon.green { background: #f0fdf4; }
.stat-icon.orange { background: #fff7ed; }
.stat-icon.red { background: #fef2f2; }

.stat-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--gray);
    font-weight: 500;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 22px;
}

/* ===== TICKETS TABLE ===== */
.tickets-table {
    width: 100%;
    border-collapse: collapse;
}

.tickets-table th {
    background: var(--bg);
    padding: 11px 16px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.tickets-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 13.5px;
}

.tickets-table tr:last-child td {
    border-bottom: none;
}

.tickets-table tr:hover td {
    background: #f8fafc;
}

.ticket-subject-link {
    color: var(--dark);
    text-decoration: none;
    font-weight: 600;
    display: block;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-subject-link:hover {
    color: var(--primary);
}

.ticket-num {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--gray);
    background: var(--bg);
    padding: 3px 8px;
    border-radius: 5px;
}

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-open { background: #eff6ff; color: var(--primary); }
.status-answered { background: #f0fdf4; color: var(--success); }
.status-pending { background: #fff7ed; color: var(--warning); }
.status-closed { background: #f1f5f9; color: var(--gray); }

.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
}

.priority-low { background: #f0fdf4; color: #16a34a; }
.priority-medium { background: #fffbeb; color: #d97706; }
.priority-high { background: #fff7ed; color: #ea580c; }
.priority-urgent { background: #fef2f2; color: #dc2626; }

/* ===== TICKET DETAIL ===== */
.ticket-info-bar {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 20px;
}

.ticket-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ticket-info-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ticket-info-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
}

/* ===== MESSAGES ===== */
.messages-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.message-bubble {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-bubble.admin-msg {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    color: white;
}

.user-avatar { background: linear-gradient(135deg, var(--accent), var(--primary)); }
.admin-avatar { background: linear-gradient(135deg, var(--success), #059669); }

.message-content {
    max-width: 70%;
}

.message-body {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px 0 12px 12px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--dark);
    box-shadow: var(--shadow-sm);
}

.admin-msg .message-body {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: transparent;
    border-radius: 0 12px 12px 12px;
}

.message-meta {
    font-size: 11px;
    color: var(--gray-light);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-msg .message-meta {
    justify-content: flex-end;
}

.message-sender {
    font-weight: 700;
    color: var(--gray);
    font-size: 12px;
}

.admin-msg .message-sender {
    color: var(--primary);
}

/* ===== REPLY BOX ===== */
.reply-box {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.reply-box-header {
    padding: 14px 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 700;
    color: var(--dark-3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.reply-box-body {
    padding: 18px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark-3);
    margin-bottom: 8px;
}

.empty-sub {
    font-size: 13px;
    margin-bottom: 24px;
}

/* ===== USER INFO IN SIDEBAR ===== */
.sidebar-user {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 700;
    color: white;
    margin-bottom: 2px;
}

.sidebar-user-role {
    font-size: 11px;
    color: #64748b;
}

/* ===== NEW TICKET FORM ===== */
.new-ticket-card {
    max-width: 680px;
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-btn {
    padding: 7px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: white;
    color: var(--gray);
    transition: all 0.2s;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .auth-left { display: none; }
    .auth-right { width: 100%; }
    .dashboard { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; top: 0; }
    .main-content { max-width: 100%; padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .message-content { max-width: 85%; }
}

/* ===== LOADING ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== DIVIDER ===== */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ===== LINK ===== */
a.text-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

a.text-link:hover { text-decoration: underline; }

.text-center { text-align: center; }
.mt-3 { margin-top: 12px; }
.mb-0 { margin-bottom: 0; }
.ms-auto { margin-right: auto; }
