/* Custom Styles for Admin Panel */

/* Persian Font - POFAKFANUM */
@font-face {
    font-family: 'POFAKFANUM';
    src: url('https://mobile.memberx.app/POFAKFANUM-REGULAR.TTF') format('truetype'),
         url('http://mobile.memberx.app/POFAKFANUM-REGULAR.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'POFAKFANUM';
    src: url('https://mobile.memberx.app/POFAKFANUM-BOLD.TTF') format('truetype'),
         url('http://mobile.memberx.app/POFAKFANUM-BOLD.TTF') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
}

body {
    font-family: 'POFAKFANUM', 'Segoe UI', Tahoma, Geneva, Verdana, 'Arial', sans-serif;
    background-color: #f8f9fa;
    direction: rtl;
    text-align: right;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Apply Persian font to all elements */
*, *::before, *::after {
    font-family: 'POFAKFANUM', 'Segoe UI', Tahoma, Geneva, Verdana, 'Arial', 'Helvetica', sans-serif;
}

/* Ensure inputs and textareas use Persian font */
input, textarea, select, button {
    font-family: 'POFAKFANUM', 'Segoe UI', Tahoma, Geneva, Verdana, 'Arial', 'Helvetica', sans-serif;
}

/* Fallback for when font doesn't load */
@supports not (font-display: swap) {
    body {
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, 'Arial', 'Helvetica', sans-serif;
    }
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    right: 0;
    left: auto;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset 1px 0 0 rgba(0, 0, 0, .1);
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100vh - 56px);
}

/* Main content area for RTL */
main.col-md-9,
main.col-lg-10 {
    margin-right: 0 !important;
    margin-left: auto !important;
    min-height: calc(100vh - 56px);
    position: relative;
    z-index: 1;
}

/* Ensure main content doesn't go under sidebar on medium screens */
@media (min-width: 768px) {
    main.col-md-9 {
        margin-right: 0 !important;
        padding-right: 1.5rem !important;
    }
}

@media (min-width: 992px) {
    main.col-lg-10 {
        margin-right: 0 !important;
        padding-right: 1.5rem !important;
    }
}

/* Fix for Bootstrap RTL - margin start/end */
.me-sm-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

.ms-sm-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

/* Container fluid for RTL */
.container-fluid {
    direction: rtl;
}

/* Row for RTL */
.row {
    direction: rtl;
}

/* Ensure sidebar doesn't overlap content */
.sidebar {
    width: auto; /* Let Bootstrap handle width */
}

/* Main content padding for RTL */
main.col-md-9,
main.col-lg-10 {
    padding-right: 1rem;
    padding-left: 1rem;
}

.sidebar .nav-link {
    color: #333;
    padding: 10px 20px;
    border-radius: 5px;
    margin: 2px 10px;
    transition: all 0.3s;
}

.sidebar .nav-link:hover {
    background-color: #e9ecef;
    color: var(--primary-color);
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.sidebar .nav-link i {
    margin-right: 8px;
    margin-left: 0;
    width: 20px;
}

.sidebar-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Statistics Cards */
.stat-card {
    border: none;
    border-radius: 15px;
    transition: transform 0.3s, box-shadow 0.3s;
    margin-bottom: 20px;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.stat-card.stat-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-card.stat-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.stat-card.stat-danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.stat-card.stat-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.stat-card.stat-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.stat-icon {
    font-size: 48px;
    opacity: 0.3;
}

/* Tables */
.table {
    background: white;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: #6c757d;
}

.table tbody tr {
    transition: background-color 0.2s;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Badges */
.badge {
    padding: 6px 12px;
    font-weight: 500;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Cards */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
    border-radius: 15px 15px 0 0 !important;
    font-weight: 600;
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 10px 15px;
    transition: all 0.3s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* RTL Support for Select Dropdown Arrow */
.form-select {
    background-position: left 0.75rem center;
    padding-left: 2.5rem;
    padding-right: 0.75rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.form-select:focus {
    background-position: left 0.75rem center;
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Responsive */
@media (max-width: 767.98px) {
    .sidebar {
        position: relative;
        top: 0;
        right: auto;
        left: auto;
        height: auto;
        width: 100%;
    }
    
    main {
        margin-top: 20px;
        margin-right: 0 !important;
        margin-left: 0 !important;
        padding-right: 1rem !important;
        padding-left: 1rem !important;
    }
    
    .container-fluid {
        padding-right: 15px;
        padding-left: 15px;
    }
}

/* Medium screens (md breakpoint: 768px+) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar {
        width: 25%; /* col-md-3 = 3/12 = 25% */
    }
    
    main.col-md-9,
    main.col-lg-10 {
        margin-right: 25% !important;
        padding-right: 1.5rem !important;
        padding-left: 1rem !important;
    }
    
    .container-fluid {
        padding-right: 0;
        padding-left: 0;
    }
}

/* Large screens (lg breakpoint: 992px to 1440px) */
@media (min-width: 992px) and (max-width: 1440px) {
    .sidebar {
        width: 16.666667%; /* col-lg-2 = 2/12 = 16.67% */
    }
    
    main.col-md-9,
    main.col-lg-10 {
        margin-right: 16.666667% !important;
        padding-right: 1.5rem !important;
        padding-left: 1rem !important;
    }
    
    .container-fluid {
        padding-right: 0;
        padding-left: 0;
    }
}

/* Large screens */
@media (min-width: 1441px) {
    .sidebar {
        width: 16.666667%; /* col-lg-2 = 2/12 = 16.67% */
    }
    
    main.col-md-9,
    main.col-lg-10 {
        margin-right: 16.666667% !important;
        padding-right: 1.5rem !important;
        padding-left: 1rem !important;
    }
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Status Indicators */
.status-online {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--success-color);
    border-radius: 50%;
    margin-right: 5px;
    margin-left: 0;
    animation: pulse 2s infinite;
}

.status-offline {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--danger-color);
    border-radius: 50%;
    margin-right: 5px;
    margin-left: 0;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Code blocks */
code {
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #e83e8c;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    direction: rtl;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Action Buttons - Enhanced Styles */
.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    white-space: nowrap;
}

.btn-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-sm:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.btn-sm i {
    font-size: 14px;
    margin-left: 4px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #0d7a72 0%, #2dd46a 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #3d8be8 0%, #00d4e8 100%);
    color: white;
}

/* Gap utility for RTL */
.gap-2 {
    gap: 0.5rem !important;
}

.gap-1 {
    gap: 0.25rem !important;
}

.gap-3 {
    gap: 1rem !important;
}

