/* Modern SaaS Dashboard Style - RTL (Dark Theme) */
:root {
    --primary: #6366f1; /* Indigo 500 */
    --primary-hover: #818cf8; /* Indigo 400 */
    --secondary: #a855f7; /* Purple 500 */
    --secondary-hover: #c084fc; /* Purple 400 */
    --accent: #ec4899; /* Pink 500 */
    --bg-color: #0f172a; /* Slate 900 */
    --text-color: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    --card-bg: #1e293b; /* Slate 800 */
    --border-color: #334155; /* Slate 700 */
    --sidebar-bg: #0f172a; 
    --sidebar-text: #f1f5f9;
    --sidebar-hover: #1e293b;
    --sidebar-active: #1e1b4b; /* Deep Indigo */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.4);
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 0.2s ease-in-out;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', 'Cairo', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* App Layout */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-left: 1px solid var(--border-color);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    transition: width var(--transition);
    overflow-y: auto;
}

.sidebar .nav-link {
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: 8px;
    margin: 4px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color var(--transition), color var(--transition);
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--text-color);
}

.sidebar .nav-link.active {
    background: var(--sidebar-active);
    color: var(--primary);
    font-weight: 600;
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-wrapper {
    flex: 1;
    margin-right: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navbar */
.top-navbar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    height: 64px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 999;
    position: sticky;
    top: 0;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: var(--shadow-sm);
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
    padding: 8px;
    border-radius: 8px;
}

.notification-btn:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 4px;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 4px;
    border-radius: 50%;
    font-weight: bold;
}

/* Page Content */
.main-content {
    padding: 32px;
    flex: 1;
}

/* Dashboard Cards */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg) !important;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow var(--transition), transform var(--transition);
    border: 1px solid var(--border-color) !important;
    flex-direction: column !important;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-details h6 {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-details h3 {
    margin: 4px 0 0 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Cards Customization */
.card {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-sm) !important;
    margin-bottom: 24px;
    transition: box-shadow var(--transition), transform var(--transition) !important;
    color: var(--text-color) !important;
}

.card:hover {
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-1px) !important;
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 16px 24px !important;
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    color: var(--text-color) !important;
}

.card-body {
    padding: 24px;
}

/* Tables (Highly Readable, Stable) */
.table-responsive {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    background: var(--card-bg);
}

.table {
    margin-bottom: 0;
    color: var(--text-color) !important;
    width: 100%;
    border-collapse: collapse;
}

.table > :not(caption) > * > * {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-color);
    background: transparent !important;
    color: var(--text-color) !important;
    vertical-align: middle;
}

.table th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted) !important;
    background: #0f172a !important; /* Distinct dark header */
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr {
    transition: background-color var(--transition);
}

.table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

.table tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.1) !important; /* Subtle primary highlight */
}

/* Badges */
.badge {
    padding: 4px 10px;
    font-weight: 500;
    font-size: 0.75rem;
    border-radius: 9999px;
    letter-spacing: 0.025em;
}
.badge-status {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}
.badge-status.status-pending { background-color: rgba(234, 179, 8, 0.1); color: #fef08a; border: 1px solid rgba(234, 179, 8, 0.2); }
.badge-status.status-processing { background-color: rgba(56, 189, 248, 0.1); color: #bae6fd; border: 1px solid rgba(56, 189, 248, 0.2); }
.badge-status.status-completed, .badge-status.status-delivered { background-color: rgba(34, 197, 94, 0.1); color: #bbf7d0; border: 1px solid rgba(34, 197, 94, 0.2); }
.badge-status.status-cancelled { background-color: rgba(239, 68, 68, 0.1); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.2); }

/* Buttons */
.btn {
    border-radius: 8px !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    padding: 8px 16px !important;
    transition: background var(--transition), box-shadow var(--transition), color var(--transition) !important;
    border: 1px solid transparent !important;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    color: white !important;
    box-shadow: var(--shadow-sm) !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--secondary-hover)) !important;
    box-shadow: var(--shadow-glow) !important;
}

.btn-outline-primary {
    border-color: var(--border-color) !important;
    color: var(--text-color) !important;
    background: var(--card-bg) !important;
}

.btn-outline-primary:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.05) !important;
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px !important;
    padding: 10px 16px !important;
    border: 1px solid var(--border-color) !important;
    background: #0f172a !important;
    color: var(--text-color) !important;
    font-size: 0.875rem !important;
    transition: border-color var(--transition), box-shadow var(--transition) !important;
}

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

.form-control:focus, .form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25) !important;
    outline: none !important;
}

.form-floating > label {
    padding: 10px 16px;
    color: var(--text-muted);
}
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--primary);
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-right: 0;
    }
}
