/* ==========================================
   منصتي - نظام التصميم الموحد
   Minasati Design System
   ========================================== */

/* CSS Variables */
:root {
    /* Primary Colors */
    --primary: #6366F1;
    --primary-light: #818CF8;
    --primary-dark: #4F46E5;
    --primary-rgb: 99, 102, 241;

    /* Secondary Colors */
    --secondary: #06B6D4;
    --secondary-light: #22D3EE;
    --secondary-dark: #0891B2;

    /* Status Colors */
    --success: #10B981;
    --success-light: #34D399;
    --warning: #F59E0B;
    --warning-light: #FBBF24;
    --error: #EF4444;
    --error-light: #F87171;
    --info: #3B82F6;

    /* Dark Theme */
    --dark: #0F172A;
    --dark-light: #1E293B;
    --dark-lighter: #334155;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366F1 0%, #06B6D4 100%);
    --gradient-secondary: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
    --gradient-success: linear-gradient(135deg, #10B981 0%, #06B6D4 100%);
    --gradient-purple: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);

    /* Glass Effect */
    --glass-bg: rgba(30, 41, 59, 0.5);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-hover: rgba(255, 255, 255, 0.05);

    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ==========================================
   Typography
   ========================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-error { color: var(--error) !important; }

/* ==========================================
   Container & Layout
   ========================================== */

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.container-sm { max-width: 800px; }
.container-md { max-width: 1000px; }
.container-lg { max-width: 1200px; }

.page-wrapper {
    min-height: calc(100vh - 70px);
    padding: var(--spacing-xl);
}

/* Grid System */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* ==========================================
   Cards
   ========================================== */

.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: var(--transition-normal);
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--glass-border);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

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

.card-body {
    padding: var(--spacing-md) 0;
}

.card-footer {
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--glass-border);
    margin-top: var(--spacing-md);
}

/* ==========================================
   Buttons
   ========================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-normal);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

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

.btn-success:hover:not(:disabled) {
    background: var(--success-light);
}

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

.btn-error, .btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.btn-error:hover:not(:disabled), .btn-danger:hover:not(:disabled) {
    background: var(--error);
    color: white;
}

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

.btn-outline:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ==========================================
   Form Elements
   ========================================== */

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.form-label .required {
    color: var(--error);
}

.form-control {
    width: 100%;
    padding: 0.9rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

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

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

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 1rem center;
    background-size: 1.2rem;
    padding-left: 2.5rem;
}

select.form-control option {
    background: var(--dark-light);
    color: white;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.form-error {
    font-size: 0.85rem;
    color: var(--error);
    margin-top: var(--spacing-xs);
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
}

.file-upload:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.file-upload i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
}

.file-upload input {
    display: none;
}

/* ==========================================
   Badges & Tags
   ========================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-light);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-light);
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-light);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* ==========================================
   Stats Cards
   ========================================== */

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    transition: var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.primary { background: var(--gradient-primary); }
.stat-icon.success { background: var(--gradient-success); }
.stat-icon.warning { background: linear-gradient(135deg, var(--warning), var(--error)); }
.stat-icon.purple { background: var(--gradient-purple); }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ==========================================
   Lists
   ========================================== */

.list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.list-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.list-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.list-item-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ==========================================
   Tables
   ========================================== */

.table-wrapper {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: var(--spacing-md);
    text-align: right;
    border-bottom: 1px solid var(--glass-border);
}

.table th {
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* ==========================================
   Tabs
   ========================================== */

.tabs {
    display: flex;
    gap: var(--spacing-xs);
    background: var(--glass-bg);
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.tab {
    padding: 0.7rem 1.2rem;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

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

/* ==========================================
   Alerts
   ========================================== */

.alert {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
}

/* ==========================================
   Empty State
   ========================================== */

.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

/* ==========================================
   Page Header
   ========================================== */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.page-title {
    font-size: 1.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

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

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-normal);
}

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

/* ==========================================
   Modal
   ========================================== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-md);
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--dark-light);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-normal);
}

.modal-close:hover {
    background: var(--error);
    color: white;
}

/* ==========================================
   Avatars
   ========================================== */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.3rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.8rem; }

/* ==========================================
   Loading & Spinners
   ========================================== */

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

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

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    color: var(--text-muted);
}

.loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
    margin-bottom: var(--spacing-md);
}

/* ==========================================
   Utility Classes
   ========================================== */

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--spacing-sm); }
.p-2 { padding: var(--spacing-md); }
.p-3 { padding: var(--spacing-lg); }
.p-4 { padding: var(--spacing-xl); }

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

/* Text Alignment */
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-center { text-align: center; }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Opacity */
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* ==========================================
   Animations
   ========================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-slide-up { animation: slideUp 0.3s ease; }
.animate-pulse { animation: pulse 2s infinite; }

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 768px) {
    .page-wrapper {
        padding: var(--spacing-md);
    }

    .page-title {
        font-size: 1.5rem;
    }

    .stat-card {
        padding: var(--spacing-md);
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ==========================================
   Print Styles
   ========================================== */

@media print {
    body {
        background: white;
        color: black;
    }

    .navbar, .btn, .tabs {
        display: none !important;
    }

    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}
