@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary-color: #0ea5e9;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);
}

body {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    padding-bottom: 80px; /* Space for sticky bottom elements on mobile */
}

/* Glassmorphism & Navbar Styling */
.navbar {
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 50%, #4338ca 100%) !important;
    box-shadow: var(--shadow-md);
    padding: 0.85rem 1rem;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.5px;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 0.85rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.navbar-nav .nav-link.active, .navbar-nav .nav-link.show {
    background: rgba(255, 255, 255, 0.15);
    /*color: #efea44 !important;*/
}

/* Modern Card Design */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* Custom Hero Cards for Worker */
.hero-card {
    background: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.3);
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

/* Modern Buttons with Touch Optimization */
.btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    transition: all 0.2s ease;
    touch-action: manipulation;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: #ffffff !important;
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn:active {
    transform: scale(0.98);
}

/* Badges */
.badge {
    padding: 0.45em 0.75em;
    font-weight: 600;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* Form Controls Touch Optimization */
.form-control, .form-select {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* Mobile Friendly Quick Navigation Dock */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
        z-index: 1050;
        display: flex;
        justify-content: space-around;
        padding: 0.5rem 0;
    }
    .mobile-bottom-nav a {
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.75rem;
        font-weight: 600;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 0.25rem 0.5rem;
    }
    .mobile-bottom-nav a.active, .mobile-bottom-nav a:hover {
        color: var(--primary-color);
    }
    .mobile-bottom-nav i {
        font-size: 1.25rem;
    }
}

/* Photo Gallery & Thumbnail Styling */
.img-thumbnail {
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.img-thumbnail:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-md);
}

/* Mobile Responsive Tables (Grid/Card Style) for RTL */
@media (max-width: 768px) {

    /* Hide table headers */
    table.grid-view.table-hover thead {
        display: none;
    }

    /* Table becomes a grid container */
    table.grid-view.table-hover,
    table.grid-view.table-hover tbody {
        display: block;
        width: 100%;
    }

    /* Rows become cards in a 2-column grid */
    table.grid-view.table-hover tbody {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    /* Card */
    table.grid-view.table-hover tr {
        display: block;
        width: 100%;
        margin: 0;
        background-color: var(--card-bg);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border-color);
        padding: 0.5rem;
        box-sizing: border-box;
    }

    /* Cells */
    table.grid-view.table-hover td {
        width: 100%;
        text-align: right;
        border: none;
        border-bottom: 1px dashed var(--border-color);
        padding: 0.75rem 0.5rem !important;
        position: relative;
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        box-sizing: border-box;
    }

    table.grid-view.table-hover td:last-child {
        border-bottom: 0;
        align-items: center;
        justify-content: center;
    }


    /* ---------------------------------
       Borderless Tables
       --------------------------------- */

    table.grid-view.table-borderless,
    table.grid-view.table-borderless tbody {
        display: block;
        width: 100%;
    }

    table.grid-view.table-borderless tbody {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    table.grid-view.table-borderless tr {
        display: block;
        width: 100%;
        margin: 0;
        background-color: var(--bg-body);
        border-radius: var(--radius-sm);
        padding: 0.75rem;
        box-sizing: border-box;
    }

    table.grid-view.table-borderless th {
        display: block;
        width: 100%;
        color: var(--text-muted);
        font-size: 0.85rem;
        padding: 0 0 0.25rem 0 !important;
    }

    table.grid-view.table-borderless td {
        display: block;
        width: 100%;
        font-weight: 600;
        padding: 0 !important;
    }
}