@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;500;600;700;800;900&display=swap');

:root {
    --primary-color: #1a4567;
    /* Deep Blue from logo */
    --secondary-color: #f4a222;
    /* Orange from logo */
    --accent-color: #2c9a9e;
    /* Teal from logo */
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --white: #ffffff;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    direction: rtl;
    background-color: #f3f4f6;
    color: var(--dark-color);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Sidebar */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--primary-color);
    color: var(--white);
    padding: 2rem 1rem;
    transition: var(--transition);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Smooth scrolling for sidebar */
.sidebar {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* For iOS smooth scrolling */
}

/* Firefox scrollbar styling */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
}

.sidebar .logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.sidebar .logo-container img {
    width: 120px;
    height: auto;
    border-radius: 50%;
    background: white;
    padding: 5px;
}

.sidebar nav ul li {
    margin-bottom: 0.5rem;
}

.sidebar nav ul li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: var(--transition);
}

.sidebar nav ul li a i {
    margin-left: 10px;
    font-size: 1.2rem;
}

.sidebar nav ul li a:hover,
.sidebar nav ul li a.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--secondary-color);
}

/* Main Content */
.main-content {
    margin-right: 280px;
    padding: 2rem;
    min-height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--white);
    padding: 1rem 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.welcome-msg h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-left: 1rem;
}

.icon-blue {
    background: rgba(26, 69, 103, 0.1);
    color: var(--primary-color);
}

.icon-orange {
    background: rgba(244, 162, 34, 0.1);
    color: var(--secondary-color);
}

.icon-teal {
    background: rgba(44, 154, 158, 0.1);
    color: var(--accent-color);
}

.stat-info h3 {
    font-size: 0.9rem;
    color: #64748b;
}

.stat-info p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
}

/* Form Styling */
.card {
    background: var(--white);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 69, 103, 0.1);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #133a56;
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-accent {
    background: var(--accent-color);
    color: var(--white);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: right;
    padding: 1rem;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.data-table tr:hover {
    background: #f1f5f9;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef9c3;
    color: #854d0e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.menu-toggle i {
    font-size: 1.5rem;
}

/* Responsive Breakpoints */

/* Tablet and Small Desktop (992px and below) */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
        padding: 1rem 0.5rem;
    }

    .sidebar .logo-container h3 {
        display: none;
    }

    .sidebar .logo-container img {
        width: 50px;
    }

    .sidebar nav ul li a span {
        display: none;
    }

    .sidebar nav ul li a {
        justify-content: center;
        padding: 0.75rem;
    }

    .sidebar nav ul li a i {
        margin-left: 0;
        font-size: 1.3rem;
    }

    .main-content {
        margin-right: 80px;
        padding: 1.5rem;
    }

    .header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .welcome-msg h1 {
        font-size: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .card {
        padding: 1.5rem;
    }
}

/* Mobile Devices (768px and below) */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(100%);
        width: 280px;
        padding: 2rem 1rem;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar .logo-container h3 {
        display: block;
    }

    .sidebar .logo-container img {
        width: 80px;
    }

    .sidebar nav ul li a span {
        display: inline;
    }

    .sidebar nav ul li a {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }

    .sidebar nav ul li a i {
        margin-left: 10px;
        font-size: 1.2rem;
    }

    .main-content {
        margin-right: 0;
        padding: 1rem;
        padding-top: 4rem;
    }

    .header {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        text-align: center;
    }

    .user-info {
        flex-direction: column;
    }

    .welcome-msg h1 {
        font-size: 1.1rem;
    }

    .welcome-msg p {
        font-size: 0.85rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
        flex-direction: row;
    }

    .stat-info h3 {
        font-size: 0.85rem;
    }

    .stat-info p {
        font-size: 1.25rem;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    /* Tables */
    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }

    /* Buttons */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
    }

    /* Forms */
    .form-control {
        font-size: 0.95rem;
        padding: 0.65rem 0.85rem;
    }

    /* Modal */
    .modal-content {
        width: 95% !important;
        padding: 1.5rem !important;
        max-height: 85vh !important;
    }

    .modal-content h2 {
        font-size: 1.1rem !important;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem;
        padding-top: 4rem;
    }

    .header {
        padding: 0.75rem;
    }

    .welcome-msg h1 {
        font-size: 1rem;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .stat-icon {
        margin-left: 0;
        margin-bottom: 0.5rem;
    }

    .card {
        padding: 0.75rem;
    }

    .card-title {
        font-size: 1rem;
        padding-bottom: 0.75rem;
    }

    /* Stack form elements */
    .form-group {
        margin-bottom: 1rem;
    }

    /* Tables - Force horizontal scroll */
    .data-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        font-size: 0.8rem;
        min-width: 600px;
    }

    .data-table th,
    .data-table td {
        padding: 0.4rem;
        white-space: nowrap;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    /* Button groups stack */
    .btn-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn {
        width: 100%;
    }
}

/* Utility Classes for Mobile */
.mobile-hidden {
    display: none !important;
}

@media (min-width: 769px) {
    .desktop-hidden {
        display: none !important;
    }
}

/* Overlay for mobile menu */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
    }
}

/* Print Styles */
@media print {

    .sidebar,
    .header,
    .menu-toggle,
    .btn,
    form {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 1rem;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .data-table {
        font-size: 0.85rem;
    }
}