/* Premium Modern UI - Professional Corporate Theme */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@200;300;400;500;700;800;900&display=swap');

:root {
    /* Brand Colors - Premium Corporate */
    --brand-primary: #0f172a;
    /* Deep Navy */
    --brand-secondary: #334155;
    /* Slate */
    --brand-accent: #c29d59;
    /* Muted Gold */
    --brand-accent-hover: #d4b578;

    /* Functional Colors */
    --action-primary: #2563eb;
    /* Vivid Blue for buttons/links */
    --action-hover: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;

    /* Backgrounds */
    --bg-body: #f1f5f9;
    /* Light Gray Blue */
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.95);

    /* Typography */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverted: #ffffff;

    /* Borders & Shadows - Ultra Refined */
    --border-subtle: #e2e8f0;
    --border-focus: #94a3b8;

    --shadow-flat: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-float: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
    --shadow-deep: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 10px 10px -5px rgba(15, 23, 42, 0.04);

    /* Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --sidebar-width: 280px;
    --header-height: 70px;
}

/* Global Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline-color: var(--action-primary);
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography Hierarchy */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 800;
    color: var(--brand-primary);
    line-height: 1.3;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

/* Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - Premium Dark */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--brand-primary);
    color: var(--text-inverted);
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-inverted);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo span {
    color: var(--brand-accent);
}

.sidebar-content {
    flex: 1;
    padding: 2rem 1rem;
    overflow-y: auto;
}

/* User Profile in Sidebar */
.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: var(--brand-accent);
    color: var(--brand-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
}

.user-info h4 {
    color: var(--text-inverted);
    font-size: 1rem;
    margin: 0;
    font-weight: 700;
}

.user-info span {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: block;
    margin-top: 2px;
}

/* Navigation */
.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-link:hover {
    color: var(--text-inverted);
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(-4px);
}

.nav-link.active {
    background: var(--action-primary);
    color: var(--text-inverted);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding: 2.5rem 3rem;
    max-width: 1600px;
}

/* Page Headers */
.page-header {
    margin-bottom: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.page-title h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Card Component - Premium */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-float);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-deep);
}

.card-header-styled {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-title::before {
    content: '';
    display: block;
    width: 6px;
    height: 24px;
    background: var(--brand-accent);
    border-radius: 4px;
}

/* Buttons - refined */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--brand-primary);
    color: var(--text-inverted);
}

.btn-primary:hover {
    background: #1e293b;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.2);
    transform: translateY(-2px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--brand-accent) 0%, var(--brand-accent-hover) 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-accent:hover {
    box-shadow: 0 8px 16px rgba(194, 157, 89, 0.3);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-subtle);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: transparent;
}

/* Forms - Modern Inputs */
.form-group {
    margin-bottom: 1.75rem;
}

.form-label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--brand-secondary);
    font-size: 0.95rem;
}

.form-input,
.form-control {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-body);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-input:focus,
.form-control:focus {
    background: var(--bg-card);
    border-color: var(--action-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Stats Cards */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-box {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-flat);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-float);
    border-color: var(--brand-accent);
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
    background: var(--bg-body);
    color: var(--brand-primary);
    transition: all 0.3s ease;
}

.stat-box.highlight .stat-icon {
    background: rgba(194, 157, 89, 0.1);
    color: var(--brand-accent);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--brand-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1rem;
}

/* Tables - Elegant */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.table th {
    background: var(--bg-body);
    padding: 1.25rem 1.5rem;
    text-align: right;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
}

.table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-weight: 500;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.02);
}

/* Badges - Refined pill shape */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-badge.approved {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.rejected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stage-badge {
    background: var(--bg-body);
    color: var(--text-secondary);
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid var(--border-subtle);
}

/* Login Page - Masterpiece */
.auth-layout {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

.auth-sidebar {
    width: 45%;
    background: var(--brand-primary);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4rem;
    color: white;
}

.auth-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top left, rgba(194, 157, 89, 0.2), transparent 70%);
}

.auth-pattern {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.auth-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: white;
    padding: 3.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-deep);
}

.auth-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.auth-logo {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: inline-block;
}

/* Animation Utilities */
.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

.fade-in-delayed {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Simple Grid System for Forms */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-md-6 {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 767px) {
    .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}