/* ============================================
   نظام إدارة بيانات العملاء (CRM) - Custom Styles
   ============================================ */

/* === RTL General === */
body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background-color: #f4f6f9;
    color: #333;
    font-size: 14px;
}

/* === Main Wrapper === */
.main-wrapper {
    margin-top: 70px;
    padding: 20px;
    min-height: calc(100vh - 120px);
}

/* === Sidebar === */
.sidebar {
    position: fixed;
    top: 56px;
    right: 0;
    bottom: 0;
    width: 250px;
    background: #1e2a3a;
    padding-top: 10px;
    z-index: 100;
    transition: all 0.3s;
    overflow-y: auto;
}

.sidebar .nav-link {
    color: #c8d6e5;
    padding: 12px 20px;
    border-radius: 0;
    margin: 2px 0;
    transition: all 0.3s;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar .nav-link.active {
    background: #4a7dff;
    color: #fff;
}

.sidebar .nav-link i {
    width: 25px;
    text-align: center;
}

/* === Cards === */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 15px 20px;
    font-weight: 600;
    border-radius: 10px 10px 0 0 !important;
}

.card-body {
    padding: 20px;
}

/* === Stat Cards === */
.stat-card {
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card .stat-icon {
    font-size: 40px;
    opacity: 0.3;
    position: absolute;
    left: 20px;
    top: 20px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 14px;
    opacity: 0.9;
}

.stat-bg-primary { background: linear-gradient(135deg, #4a7dff, #6c63ff); }
.stat-bg-success { background: linear-gradient(135deg, #2ed573, #7bed9f); }
.stat-bg-warning { background: linear-gradient(135deg, #ffa502, #ff6348); }
.stat-bg-info { background: linear-gradient(135deg, #17a2b8, #00d2d3); }
.stat-bg-danger { background: linear-gradient(135deg, #ff4757, #ff6b81); }
.stat-bg-dark { background: linear-gradient(135deg, #2f3542, #57606f); }

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

.table {
    margin-bottom: 0;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: #555;
    border-top: none;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    padding: 12px 10px;
}

.table-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* === Forms === */
.form-label {
    font-weight: 600;
    color: #444;
    margin-bottom: 5px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 10px 15px;
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    border-color: #4a7dff;
    box-shadow: 0 0 0 0.2rem rgba(74,125,255,0.15);
}

/* === Buttons === */
.btn {
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 500;
    font-size: 14px;
}

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

.btn-primary {
    background: #4a7dff;
    border-color: #4a7dff;
}

.btn-primary:hover {
    background: #3a6de0;
    border-color: #3a6de0;
}

/* === Badges === */
.badge {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
}

/* === Login Page === */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 420px;
    border-radius: 20px;
    padding: 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo i {
    font-size: 50px;
    color: #4a7dff;
}

.login-logo h3 {
    margin-top: 15px;
    color: #333;
}

/* === Modal === */
.modal-content {
    border-radius: 15px;
    border: none;
}

.modal-header {
    background: #f8f9fa;
    border-radius: 15px 15px 0 0;
}

/* === Search Box === */
.search-box {
    position: relative;
}

.search-box .form-control {
    padding-right: 40px;
}

.search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

/* === Alert Messages === */
.alert {
    border-radius: 10px;
    border: none;
}

/* === Footer === */
.footer {
    background: #fff;
    padding: 15px 0;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #666;
}

/* === Print Styles === */
@media print {
    .navbar, .sidebar, .footer, .no-print { display: none !important; }
    .main-wrapper { margin-top: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* === Responsive === */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        top: 0;
    }
    .main-wrapper {
        margin-right: 0;
    }
    .stat-card .stat-value {
        font-size: 24px;
    }
}

/* === Extra Utilities === */
.cursor-pointer { cursor: pointer; }
.text-decoration-none { text-decoration: none; }
.w-120 { width: 120px; }
.min-w-200 { min-width: 200px; }

/* === Invoice/Quotation Preview === */
.preview-container {
    background: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

.preview-header {
    border-bottom: 2px solid #4a7dff;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.preview-table th {
    background: #f0f4ff;
    color: #4a7dff;
}

/* === Loading Spinner === */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}
