:root {
    --primary-color: #2c3e50;
    /* Deep Blue */
    --accent-color: #3498db;
    /* Bright Blue */
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #9b59b6;
    --light-bg: #ecf0f1;
    --white: #ffffff;
    --text-color: #2c3e50;
    --border-radius: 12px;
    --box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    background-color: var(--light-bg);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

/* Auth Pages */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2c3e50 0%, #4ca1af 100%);
}

.login-container {
    background: var(--white);
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--accent-color);
}

.login-header h1 {
    color: var(--primary-color);
    font-weight: 800;
    margin-bottom: 0.5rem;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--primary-color);
    color: var(--white);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1.5rem;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 1rem 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    margin-bottom: 0.8rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-weight: 500;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    transform: translateX(-5px);
}

.sidebar-menu a i {
    margin-left: 10px;
}

.main-content {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
}

/* Cards */
.card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--light-bg);
    padding-bottom: 1rem;
}

.card-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* Forms */
.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 700;
    color: var(--text-color);
}

.form-control,
input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e1e8ed;
    border-radius: var(--border-radius);
    font-family: inherit;
    transition: var(--transition);
    background-color: #fdfdfd;
    box-sizing: border-box;
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
    background-color: var(--white);
}

/* Buttons */
.btn {
    padding: 0.8rem 1.8rem;
    border-radius: var(--border-radius);
    font-weight: 700;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color) 0%, #2980b9 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: #bdc3c7;
    color: var(--primary-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-block {
    width: 100%;
    display: flex;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.8rem;
    /* Row spacing */
}

.table th {
    color: #7f8c8d;
    font-weight: 600;
    padding: 1rem;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    transition: var(--transition);
    border-radius: 8px;
    /* Does not verify well on tables directly, needs cells */
}

.table tbody tr td:first-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.table tbody tr td:last-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.table tbody tr:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.table td {
    padding: 1.2rem;
    vertical-align: middle;
}

/* Badges */
.badge {
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-pending {
    background-color: #ffeaa7;
    color: #d35400;
}

.badge-in_progress {
    background-color: #dff9fb;
    color: #3498db;
}

.badge-needs_info {
    background-color: #dfe6e9;
    color: #2d3436;
}

.badge-approved {
    background-color: #d5f5e3;
    color: #27ae60;
}

.badge-rejected {
    background-color: #fadbd8;
    color: #c0392b;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 5px solid #28a745;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 5px solid #dc3545;
}

/* Timeline */
/* Timeline Redesign */
.timeline {
    position: relative;
    padding: 20px 0;
    margin-top: 2rem;
    list-style: none;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: #e9ecef;
    margin-left: -1px;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    clear: both;
}

.timeline-item::after {
    content: "";
    display: table;
    clear: both;
}

.timeline-item .timeline-badge {
    color: #fff;
    width: 40px;
    height: 40px;
    line-height: 40px;
    font-size: 1.2em;
    text-align: center;
    position: absolute;
    top: 0;
    left: 50%;
    margin-left: -20px;
    background-color: #999999;
    z-index: 100;
    border-radius: 50%;
    box-shadow: 0 0 0 5px #fff;
}

.timeline-item .timeline-panel {
    width: 44%;
    float: left;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    position: relative;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

/* Right side items */
.timeline-item.inverted .timeline-panel {
    float: right;
}

/* Connectors */
.timeline-item .timeline-panel::before {
    position: absolute;
    top: 20px;
    right: -15px;
    display: inline-block;
    border-top: 15px solid transparent;
    border-left: 15px solid #e9ecef;
    border-right: 0 solid #e9ecef;
    border-bottom: 15px solid transparent;
    content: " ";
}

.timeline-item .timeline-panel::after {
    position: absolute;
    top: 21px;
    right: -14px;
    display: inline-block;
    border-top: 14px solid transparent;
    border-left: 14px solid #fff;
    border-right: 0 solid #fff;
    border-bottom: 14px solid transparent;
    content: " ";
}

.timeline-item.inverted .timeline-panel::before {
    border-left-width: 0;
    border-right-width: 15px;
    left: -15px;
    right: auto;
}

.timeline-item.inverted .timeline-panel::after {
    border-left-width: 0;
    border-right-width: 14px;
    left: -14px;
    right: auto;
}

/* Status Update Special Style */
.timeline-item.status-update .timeline-panel {
    width: 60%;
    float: none;
    margin: 0 auto;
    text-align: center;
    background: #e8f8f5;
    border-color: #d1f2eb;
}

.timeline-item.status-update .timeline-badge {
    background-color: #2ecc71 !important;
}

.timeline-item.status-update .timeline-panel::before,
.timeline-item.status-update .timeline-panel::after {
    display: none;
}

/* Colors */
.badge-primary {
    background-color: var(--accent-color) !important;
}

.badge-info {
    background-color: var(--info-color) !important;
}

.badge-success {
    background-color: var(--success-color) !important;
}

.badge-warning {
    background-color: var(--warning-color) !important;
}

.badge-danger {
    background-color: var(--danger-color) !important;
}

/* Responsive */
@media (max-width: 767px) {
    .timeline::before {
        left: 20px;
    }

    .timeline-item .timeline-badge {
        left: 20px;
        margin-left: 0;
    }

    .timeline-item .timeline-panel {
        float: right;
        width: calc(100% - 70px);
    }

    .timeline-item.inverted .timeline-panel {
        float: right;
    }

    .timeline-item .timeline-panel::before {
        border-left-width: 0;
        border-right-width: 15px;
        left: -15px;
        right: auto;
    }

    .timeline-item .timeline-panel::after {
        border-left-width: 0;
        border-right-width: 14px;
        left: -14px;
        right: auto;
    }
}

/* Fix CSS variable usage inside component */

/* Responsive Design & Mobile Optimization */
@media screen and (max-width: 992px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar-header {
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .sidebar-header h3 {
        font-size: 1.2rem;
    }

    .sidebar-menu {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .sidebar-menu a {
        flex: 1;
        min-width: 120px;
        margin-bottom: 0;
        justify-content: center;
        text-align: center;
        font-size: 0.9rem;
    }

    .sidebar-menu a i {
        margin-left: 5px;
    }

    .main-content {
        padding: 1.5rem;
    }
}

@media screen and (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .card-header h2 {
        font-size: 1.3rem;
    }

    /* Responsive Tables */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 600px;
        /* Force scroll on small screens */
    }

    /* Buttons */
    .btn {
        width: 100%;
        /* Full width on mobile */
        margin-bottom: 0.5rem;
        justify-content: center;
    }

    .btn i {
        margin-left: 8px;
    }

    /* Timeline Mobile Fixes */
    .timeline::before {
        left: 20px;
    }

    .timeline-item .timeline-badge {
        left: 20px;
        margin-left: 0;
    }

    .timeline-item .timeline-panel {
        float: right;
        width: calc(100% - 70px);
    }

    .timeline-item.inverted .timeline-panel {
        float: right;
    }

    .timeline-item .timeline-panel::before {
        border-left-width: 0;
        border-right-width: 15px;
        left: -15px;
        right: auto;
    }

    .timeline-item .timeline-panel::after {
        border-left-width: 0;
        border-right-width: 14px;
        left: -14px;
        right: auto;
    }

    .timeline-item.status-update .timeline-panel {
        width: calc(100% - 70px);
    }
}

/* Stats Cards Premium Design */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
    margin-top: 20px;
}

.stat-card {
    background: #fff;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    border: none;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
    border-bottom: 4px solid transparent;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-left: 20px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-info {
    flex-grow: 1;
}

.stat-info h3 {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.2;
}

.stat-info p {
    margin: 5px 0 0;
    color: #95a5a6;
    font-size: 0.95rem;
    font-weight: 600;
}

/* Specific Card Styling */
.stat-card.primary {
    border-bottom-color: var(--accent-color);
}

.stat-card.primary .stat-icon {
    background: rgba(52, 152, 219, 0.1);
    color: var(--accent-color);
}

.stat-card.primary:hover .stat-icon {
    background: var(--accent-color);
    color: #fff;
}

.stat-card.warning {
    border-bottom-color: #f1c40f;
}

.stat-card.warning .stat-icon {
    background: rgba(241, 196, 15, 0.1);
    color: #f1c40f;
}

.stat-card.warning:hover .stat-icon {
    background: #f1c40f;
    color: #fff;
}

.stat-card.success {
    border-bottom-color: #2ecc71;
}

.stat-card.success .stat-icon {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.stat-card.success:hover .stat-icon {
    background: #2ecc71;
    color: #fff;
}

.stat-card.danger {
    border-bottom-color: #e74c3c;
}

.stat-card.danger .stat-icon {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.stat-card.danger:hover .stat-icon {
    background: #e74c3c;
    color: #fff;
}

/* Notification Badge Pulse */
@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

.notification-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--danger-color);
    border-radius: 50%;
    margin-right: 5px;
    animation: pulse-red 2s infinite;
}