@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;700&family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
    --primary-hue: 220;
    --primary: hsl(var(--primary-hue), 85%, 55%);
    --primary-dark: hsl(var(--primary-hue), 90%, 35%);
    --primary-light: hsl(var(--primary-hue), 90%, 96%);

    --accent-hue: 260;
    --accent: hsl(var(--accent-hue), 80%, 65%);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --bg-dark: #0f172a;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.7);

    --text-main: #1e293b;
    --text-muted: #64748b;

    --border: rgba(148, 163, 184, 0.2);
    --shadow-sm: 0 4px 6px -1px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --gradient-main: linear-gradient(135deg, hsl(220, 85%, 55%), hsl(260, 80%, 65%));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

body {
    background-color: #f8fafc;
    background-image:
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.1) 0px, transparent 50%);
    color: var(--text-main);
    direction: rtl;
    min-height: 100vh;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-subtle {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.2);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-dark);
    color: white;
    padding: 25px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    right: 0;
    top: 0;
    z-index: 1000;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
}

.logo {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.logo h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 10px;
}

.logo i {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar li {
    padding: 16px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
    color: #94a3b8;
    position: relative;
    overflow: hidden;
}

.sidebar li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05));
    transform: translateX(100%);
    transition: transform 0.3s;
}

.sidebar li:hover::before {
    transform: translateX(0);
}

.sidebar li:hover {
    color: white;
    transform: translateX(-5px);
}

.sidebar li.active {
    background: var(--gradient-main);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.5);
    font-weight: 700;
}

.sidebar li i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.footer {
    margin-top: auto;
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: 280px;
    padding: 30px 40px;
    transition: all 0.3s;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    position: relative;
    display: inline-block;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 0;
    width: 60px;
    height: 4px;
    background: var(--gradient-main);
    border-radius: 2px;
}

.user-profile {
    background: white;
    padding: 10px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.3s;
}

.user-profile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.user-profile span {
    font-weight: 700;
    color: var(--primary-dark);
}

.user-profile i {
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: color 0.2s;
}

.user-profile i:hover {
    color: var(--danger);
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 25px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-card .icon {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
}

.stat-card.blue .icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-card.green .icon {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-card.orange .icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-card.red .icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.stat-card .info {
    flex: 1;
}

.stat-card .info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .info p {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

/* Alerts Grid */
.alerts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.alert-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.alert-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--gradient-main);
    transition: width 0.3s;
}

.alert-card:hover::before {
    width: 8px;
}

.alert-card:hover {
    transform: translateX(-5px);
    box-shadow: var(--shadow-lg);
}

.alert-card h4 {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.alert-card h4 i {
    color: var(--primary);
    background: var(--primary-light);
    padding: 10px;
    border-radius: 12px;
}

.badge {
    background: var(--danger);
    color: white;
    padding: 6px 16px;
    border-radius: 50px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

/* Forms */
.form-container {
    background: white;
    padding: 40px;
    border-radius: 24px;
    box-shadow: var(--shadow-sm);
    max-width: 1400px;
    margin: 0 auto;
    border: 1px solid var(--border);
}

.form-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.form-header h2 {
    color: var(--primary-dark);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 15px;
}

.form-group-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 40px 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-right: 15px;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.input-box label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.input-box input,
.input-box select,
.input-box textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    background: #f8fafc;
    transition: all 0.3s;
    color: var(--text-main);
}

.input-box input:focus,
.input-box select:focus,
.input-box textarea:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

.form-actions {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 20px;
}

.btn-primary,
.btn-secondary {
    padding: 14px 35px;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background: var(--gradient-main);
    color: white;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(37, 99, 235, 0.5);
}

.btn-secondary {
    background: white;
    color: var(--text-muted);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: #f8fafc;
    color: var(--text-main);
}


/* Table */
.table-container {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8fafc;
    padding: 20px;
    text-align: right;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
}

td {
    padding: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-main);
    font-weight: 500;
}

tr:hover td {
    background: #f1f5f9;
}

/* Modal */
/* Modal Overlay */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    /* Higher than sidebar 1000 */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    margin: 5% auto;
    /* Fallback */
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 900px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.close-modal {
    position: absolute;
    left: 25px;
    top: 25px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--danger);
}

/* Action Buttons in Grid */
.action-btn {
    background: #f1f5f9;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 4px;
    transition: all 0.2s;
    color: var(--text-muted);
}

.action-btn:hover {
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.action-btn.edit:hover {
    color: var(--primary);
}

.action-btn.delete:hover {
    color: var(--danger);
}


/* Login */
#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    backdrop-filter: blur(20px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 60px 40px;
    border-radius: 30px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 15px 10px;
    }

    .sidebar span,
    .logo h2,
    .footer {
        display: none;
    }

    .main-content {
        margin-right: 80px;
    }

    .sidebar li {
        justify-content: center;
    }

    .sidebar li i {
        font-size: 1.5rem;
    }
}