/* ============================================
   Sume Technical Support - Main Stylesheet
   ============================================ */

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --secondary: #06b6d4;
    --danger: #e02424;
    --warning: #ff9800;
    --bg: #f0fdf4;
    --card: #ffffff;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --sidebar-w: 260px;
    --radius: 12px;
    --shadow: 0 2px 16px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    font-size: 15px;
}

a { text-decoration: none; color: var(--primary); }
a:hover { text-decoration: underline; }

/* ===== AUTH PAGES ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    padding: 20px;
}

.auth-box {
    background: #fff;
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-size: 24px;
    color: var(--primary);
    font-weight: 800;
}

.auth-logo p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    direction: rtl;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
    transform: translateY(-1px);
}

.form-control.error { border-color: var(--danger); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }
.btn-primary:hover { 
    background: var(--primary-dark); 
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}
.btn-success { background: var(--secondary); color: #fff; box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3); }
.btn-success:hover { 
    background: #0891b2; 
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.4);
}
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 12px rgba(224, 36, 36, 0.3); }
.btn-danger:hover { 
    background: #c41f1f; 
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(224, 36, 36, 0.4);
}
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { 
    border-color: var(--primary); 
    color: var(--primary);
    background: rgba(16, 185, 129, 0.05);
    transform: translateY(-1px);
}
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }

/* ===== LAYOUT ===== */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: #1e2a3a;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo h2 { color: #fff; font-size: 18px; font-weight: 800; }
.sidebar-logo span { color: #94a3b8; font-size: 12px; }

.sidebar-nav { padding: 16px 0; flex: 1; }

.nav-section { padding: 8px 20px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #64748b; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #94a3b8;
    transition: all 0.3s ease;
    cursor: pointer;
    border-right: 3px solid transparent;
    position: relative;
}

.nav-item:hover, .nav-item.active {
    background: rgba(16, 185, 129, 0.15);
    color: #fff;
    border-right-color: #10b981;
    text-decoration: none;
    padding-right: 24px;
}

.nav-item i { width: 20px; text-align: center; font-size: 16px; }

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user .avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sidebar-user:hover .avatar {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.sidebar-user .info { overflow: hidden; }
.sidebar-user .name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .role { color: #64748b; font-size: 11px; }

/* Main Content */
.main {
    margin-right: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    background: #fff;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title { font-size: 20px; font-weight: 700; }

.topbar-actions { display: flex; align-items: center; gap: 14px; }

.notif-btn {
    position: relative;
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; background: #fff;
    transition: all 0.3s ease;
    color: var(--text-muted);
    font-size: 17px;
}
.notif-btn:hover { 
    border-color: var(--primary); 
    color: var(--primary);
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}
.notif-badge {
    position: absolute;
    top: -4px; left: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    width: 17px; height: 17px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}

/* Page Content */
.page-content { padding: 28px; flex: 1; }

/* ===== CARDS ===== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h3 { font-size: 16px; font-weight: 700; }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: #f9fafb; }

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 22px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.stat-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}
.stat-icon.blue   { background: #d1fae5; color: #065f46; }
.stat-icon.green  { background: #a7f3d0; color: #065f46; }
.stat-icon.yellow { background: #fef9c3; color: #92400e; }
.stat-icon.red    { background: #fee2e2; color: #991b1b; }

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(-5deg);
}

.stat-info .value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-info .label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ===== TABLES ===== */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table thead th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: right;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    font-size: 13px;
    white-space: nowrap;
}

table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table tbody tr:hover { 
    background: rgba(16, 185, 129, 0.05);
    transition: all 0.2s ease;
}
table tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s ease;
    cursor: default;
}

.badge:hover {
    transform: scale(1.05);
}

.badge-open      { background: #d1fae5; color: #065f46; }
.badge-progress  { background: #fef9c3; color: #92400e; }
.badge-waiting   { background: #f3e8ff; color: #6b21a8; }
.badge-resolved  { background: #a7f3d0; color: #065f46; }
.badge-closed    { background: #f3f4f6; color: #6b7280; }

.priority-low      { background: #d1fae5; color: #065f46; }
.priority-medium   { background: #fef9c3; color: #92400e; }
.priority-high     { background: #fee2e2; color: #991b1b; }
.priority-critical { background: #991b1b; color: #fff; }

/* ===== TICKET DETAIL ===== */
.ticket-header {
    background: linear-gradient(135deg, #10b981, #06b6d4);
    color: #fff;
    padding: 24px;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.3s ease;
}

.ticket-number { font-size: 13px; opacity: 0.8; margin-bottom: 6px; }
.ticket-title  { font-size: 20px; font-weight: 700; }

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 14px;
    font-size: 13px;
    opacity: 0.9;
}

.ticket-meta span { display: flex; align-items: center; gap: 6px; }

/* Chat-style replies */
.replies { display: flex; flex-direction: column; gap: 16px; }

.reply-bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 14px;
}

.reply-user {
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    align-self: flex-end;
    border-bottom-left-radius: 4px;
}

.reply-agent {
    background: #fff;
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-right-radius: 4px;
}

.reply-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }

/* ===== KB ===== */
.kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.kb-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}
.kb-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2);
    transform: translateY(-4px) scale(1.02);
    text-decoration: none;
}
.kb-card i { 
    font-size: 32px; 
    color: var(--primary); 
    margin-bottom: 12px;
    transition: all 0.3s ease;
}
.kb-card:hover i {
    transform: scale(1.2) rotate(10deg);
}
.kb-card h4 { font-size: 15px; font-weight: 700; }
.kb-card p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ===== MOBILE ===== */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main { margin-right: 0; }
    .menu-toggle { display: block; }
    .page-content { padding: 16px; }
    .topbar { padding: 12px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

/* ===== MISC ===== */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.fw-bold { font-weight: 700; }
.fs-sm { font-size: 13px; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; display: block; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }

.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    direction: ltr;
}

.otp-inputs input {
    width: 50px; height: 56px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.otp-inputs input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
    transform: scale(1.05) translateY(-2px);
}

/* Loading spinner */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ===== ANIMATIONS ===== */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(16, 185, 129, 0.5); }
    50% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.8); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.card {
    animation: slideInUp 0.4s ease-out;
}

.nav-item {
    animation: fadeIn 0.3s ease-out;
}

a {
    transition: all 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}