/* ============================================
   Oguard Web - Custom Theme
   مشابه تم WPF با رنگ‌های سبزآبی و تیره
   ============================================ */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    /* رنگ اصلی (سبزآبی/تیل) */
    --primary: #00A693;
    --primary-dark: #008577;
    --primary-light: #33B8A8;
    --primary-hover: #00917f;
    
    /* رنگ ثانویه (تیره) */
    --secondary: #1E2A3A;
    --secondary-dark: #151E2A;
    --secondary-light: #2A3A4E;
    
    /* رنگ‌های پس‌زمینه */
    --bg-main: #E8EEF2;
    --bg-light: #F5F7FA;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    
    /* رنگ‌های متن */
    --text-primary: #1E2A3A;
    --text-secondary: #6B7C8D;
    --text-light: #FFFFFF;
    --text-muted: #9BA8B4;
    
    /* رنگ‌های وضعیت */
    --success: #28A745;
    --warning: #FFC107;
    --danger: #DC3545;
    --info: #17A2B8;
    
    /* سایه */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    
    /* گرادیان */
    --gradient-primary: linear-gradient(135deg, #00A693 0%, #008577 100%);
    --gradient-dark: linear-gradient(135deg, #1E2A3A 0%, #2A3A4E 100%);
    --gradient-bg: linear-gradient(135deg, #C5D5E4 0%, #E8EEF2 50%, #D0DDE8 100%);
    
    /* فونت */
    --font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    
    /* انیمیشن */
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
}

/* ============================================
   فونت وزیرمتن
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

/* ============================================
   Base Styles
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
}

body {
    font-family: var(--font-family);
    background: var(--bg-main);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ============================================
   Layout
   ============================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-left: 1px solid rgba(0,0,0,0.08);
    box-shadow: var(--shadow);
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    background: var(--gradient-primary);
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 45px;
    height: 45px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.sidebar-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.sidebar-brand small {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 5px;
}

.nav-section-title {
    padding: 10px 20px 5px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-fast);
    border-right: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.nav-item.active {
    background: rgba(0, 166, 147, 0.08);
    color: var(--primary);
    border-right-color: var(--primary);
    font-weight: 500;
}

.nav-item i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.nav-badge {
    margin-right: auto;
    margin-left: 0;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(0,0,0,0.08);
    background: var(--bg-light);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.sidebar-user-info {
    flex: 1;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.main-header {
    background: var(--bg-card);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-title h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.breadcrumb {
    display: flex;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-search {
    position: relative;
}

.header-search input {
    background: var(--bg-light);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 15px 8px 35px;
    width: 250px;
    font-family: inherit;
    transition: var(--transition-fast);
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-light);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition-fast);
}

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

.header-btn .badge {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 25px 30px;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: none;
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    background: transparent;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    background: var(--bg-light);
    border-top: 1px solid rgba(0,0,0,0.06);
}

/* Stats Cards */
.stat-card {
    padding: 20px;
    border-radius: 12px;
    background: white;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

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

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary {
    background: rgba(0, 166, 147, 0.12);
    color: var(--primary);
}

.stat-icon.success {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success);
}

.stat-icon.warning {
    background: rgba(255, 193, 7, 0.12);
    color: var(--warning);
}

.stat-icon.danger {
    background: rgba(220, 53, 69, 0.12);
    color: var(--danger);
}

.stat-icon.info {
    background: rgba(23, 162, 184, 0.12);
    color: var(--info);
}

.stat-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.stat-content p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 166, 147, 0.3);
}

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

.btn-secondary:hover {
    background: var(--secondary-dark);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

.btn-light {
    background: var(--bg-light);
    color: var(--text-secondary);
}

.btn-light:hover {
    background: var(--bg-main);
}

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #dce4ec;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition-fast);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 147, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.invalid-feedback {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 5px;
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B7C8D' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 35px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ============================================
   Tables
   ============================================ */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: 12px 15px;
    text-align: right;
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-bottom: 2px solid #dce4ec;
}

.table td {
    padding: 14px 15px;
    border-bottom: 1px solid #eef2f6;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(0, 166, 147, 0.03);
}

.table-striped tbody tr:nth-child(odd) {
    background: var(--bg-light);
}

/* ============================================
   Badges & Status
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary {
    background: rgba(0, 166, 147, 0.12);
    color: var(--primary);
}

.badge-success {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success);
}

.badge-warning {
    background: rgba(255, 193, 7, 0.12);
    color: #b38600;
}

.badge-danger {
    background: rgba(220, 53, 69, 0.12);
    color: var(--danger);
}

.badge-info {
    background: rgba(23, 162, 184, 0.12);
    color: var(--info);
}

.badge-secondary {
    background: rgba(30, 42, 58, 0.12);
    color: var(--secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 6px;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--text-muted); }
.status-dot.warning { background: var(--warning); }

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert i {
    font-size: 1.2rem;
    margin-top: 2px;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.alert-info {
    background: rgba(23, 162, 184, 0.1);
    color: var(--info);
    border: 1px solid rgba(23, 162, 184, 0.2);
}

/* ============================================
   Login Page
   ============================================ */
.login-page {
    min-height: 100vh;
    background: var(--gradient-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    background: var(--gradient-primary);
    padding: 40px 30px;
    text-align: center;
    color: white;
}

.login-logo {
    width: 70px;
    height: 70px;
    background: rgba(255,255,255,0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 2rem;
}

.login-header h1 {
    font-size: 1.5rem;
    margin: 0 0 5px;
}

.login-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.login-body {
    padding: 30px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-control {
    padding: 14px 15px;
}

.login-form .btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #dce4ec;
}

.login-divider span {
    padding: 0 15px;
}

.login-footer {
    text-align: center;
    padding: 20px 30px 30px;
}

.login-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* ============================================
   Dashboard Specific
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.chart-container {
    height: 300px;
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eef2f6;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.activity-content h4 {
    font-size: 0.9rem;
    margin: 0 0 3px;
    font-weight: 500;
}

.activity-content p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.activity-time {
    margin-right: auto;
    margin-left: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   Progress Bars
   ============================================ */
.progress {
    height: 8px;
    background: var(--bg-light);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
}

.progress-bar.primary { background: var(--gradient-primary); }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
}

.page-link {
    padding: 8px 14px;
    border-radius: 8px;
    background: white;
    color: var(--text-secondary);
    border: 1px solid #dce4ec;
    transition: var(--transition-fast);
}

.page-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ============================================
   Modal
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(30, 42, 58, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-backdrop.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eef2f6;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 20px;
}

/* ============================================
   Loading
   ============================================ */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .mobile-menu-btn {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .header-search {
        display: none;
    }
    
    .page-content {
        padding: 15px;
    }
    
    .card-body {
        padding: 15px;
    }
}

/* ============================================
   Utilities
   ============================================ */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.bg-primary { background: var(--primary) !important; }
.bg-success { background: var(--success) !important; }
.bg-danger { background: var(--danger) !important; }
.bg-warning { background: var(--warning) !important; }
.bg-light { background: var(--bg-light) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.mb-4 { margin-bottom: 32px !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }

.d-flex { display: flex !important; }
.d-none { display: none !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-1 { gap: 8px !important; }
.gap-2 { gap: 16px !important; }

.rounded { border-radius: 8px !important; }
.rounded-lg { border-radius: 12px !important; }
.shadow { box-shadow: var(--shadow) !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.mobile-menu-btn {
    display: none;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ============================================
   RTL Specific Fixes
   ============================================ */
.sidebar {
    right: 0;
    left: auto;
}

.main-content {
    margin-right: 260px;
    margin-left: 0;
}

.nav-item {
    border-right: 3px solid transparent;
    border-left: none;
}

.nav-item.active {
    border-right-color: var(--primary);
}

/* Persian Number Font */
.persian-num {
    font-feature-settings: "ss01";
}
