/* Custom Styles for EduManager */

/* RTL Support */
[dir="rtl"] {
    direction: rtl;
}

[dir="rtl"] .nav-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .nav-item i {
    margin-left: 0;
    margin-right: 12px;
}

[dir="rtl"] #sidebar {
    left: auto;
    right: 0;
}

[dir="rtl"] main {
    margin-left: 0;
    margin-right: 16rem;
}

[dir="rtl"] #language-selector {
    left: 1rem;
    right: auto;
}

[dir="rtl"] .flex.items-center > *:not(:first-child) {
    margin-left: 0;
    margin-right: 0.75rem;
}

[dir="rtl"] .space-x-4 > * + * {
    margin-left: 0;
    margin-right: 1rem;
}

/* Arabic Font */
[lang="ar"], [lang="ar"] * {
    font-family: 'Amiri', Arial, sans-serif !important;
}

/* Tifinagh Font */
[lang="amz"], [lang="amz"] * {
    font-family: 'Ebrima', 'Segoe UI Symbol', sans-serif !important;
}

/* Mobile RTL Adjustments */
@media (max-width: 1024px) {
    [dir="rtl"] main {
        margin-right: 0;
    }
    
    [dir="rtl"] #sidebar {
        right: -100%;
        transform: translateX(0);
    }
    
    [dir="rtl"] #sidebar.open {
        right: 0;
    }
}

/* Custom Components */
.nav-item.active {
    background-color: #eff6ff;
    color: #2563eb;
    border-right: 3px solid #2563eb;
}

[dir="rtl"] .nav-item.active {
    border-right: none;
    border-left: 3px solid #2563eb;
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.2s ease-in-out;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background-color: #dcfce7;
    color: #16a34a;
}

.badge-warning {
    background-color: #fef3c7;
    color: #d97706;
}

.badge-danger {
    background-color: #fee2e2;
    color: #dc2626;
}

.badge-info {
    background-color: #dbeafe;
    color: #2563eb;
}

/* Progress Bars */
.progress-bar {
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #3b82f6;
    transition: width 0.3s ease;
}

.progress-fill.success {
    background-color: #22c55e;
}

.progress-fill.warning {
    background-color: #f59e0b;
}

.progress-fill.danger {
    background-color: #ef4444;
}

/* Avatar Styles */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.25rem;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

[dir="rtl"] .table th,
[dir="rtl"] .table td {
    text-align: right;
}

.table th {
    font-weight: 600;
    color: #374151;
    background-color: #f9fafb;
}

.table tbody tr:hover {
    background-color: #f9fafb;
}

/* Modal Styles */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
    padding-right: 2.5rem;
}

[dir="rtl"] .form-select {
    background-position: left 0.5rem center;
    padding-right: 0.75rem;
    padding-left: 2.5rem;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

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

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2563eb;
}

.btn-success {
    background-color: #22c55e;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #16a34a;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: #d97706;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
}

.btn-outline {
    background-color: transparent;
    border-color: #d1d5db;
    color: #374151;
}

.btn-outline:hover:not(:disabled) {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Icon Button */
.btn-icon {
    padding: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
}

/* Loading Spinner */
.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Toast Styles */
.toast {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid #3b82f6;
    animation: slideIn 0.3s ease-out;
}

.toast.success {
    border-left-color: #22c55e;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast.error {
    border-left-color: #ef4444;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Dashboard Cards */
.dashboard-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.stat-card {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
}

.stat-label {
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Responsive Design */
@media (max-width: 640px) {
    .dashboard-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .page-break {
        page-break-before: always;
    }
}