:root {
    /* Morocco-themed colors */
    --red-primary: 218 41% 28%; /* #C1272D - Morocco flag red */
    --green-primary: 120 100% 25%; /* #006233 - Morocco flag green */
    --gold-accent: 45 100% 51%; /* #DAA520 - Moroccan gold */
    
    /* Neutral colors */
    --gray-50: 210 40% 98%;
    --gray-100: 210 40% 96%;
    --gray-200: 214 32% 91%;
    --gray-300: 213 27% 84%;
    --gray-400: 215 20% 65%;
    --gray-500: 215 16% 47%;
    --gray-600: 215 19% 35%;
    --gray-700: 215 25% 27%;
    --gray-800: 215 28% 17%;
    --gray-900: 222 84% 5%;
    
    /* Semantic colors */
    --success: 142 76% 36%;
    --warning: 38 92% 50%;
    --danger: 0 84% 60%;
    --info: 199 89% 48%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: hsl(var(--gray-50));
    color: hsl(var(--gray-800));
    line-height: 1.5; /* Slightly reduced from 1.6 */
    font-size: 0.85rem; /* Smaller base font */
}

/* Morocco-themed navbar - compact */
.bg-morocco {
    background: linear-gradient(135deg, hsl(var(--red-primary)) 0%, hsl(var(--green-primary)) 100%);
}

/* Alternative header color options */
.bg-morocco-red {
    background: hsl(var(--red-primary));
}

.bg-morocco-green {
    background: hsl(var(--green-primary));
}

.bg-morocco-blue {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

.bg-morocco-dark {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
}

.bg-morocco-modern {
    background: linear-gradient(135deg, #059669 0%, #0891b2 100%);
}

/* Compact navbar */
.navbar-brand {
    font-size: 1.2rem; /* Slightly reduced */
    font-weight: 700;
}

.navbar {
    padding: 0.4rem 0.8rem; /* Compact padding */
}

.navbar-nav .nav-link {
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
}

/* Category tabs */
.category-tabs {
    border-bottom: 2px solid hsl(var(--gray-200));
    margin-bottom: 1.8rem; /* Slightly reduced */
}

.category-tabs-container {
    overflow-x: auto;
}

.category-tabs-container::-webkit-scrollbar {
    display: none;
}

.category-tabs-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    min-width: max-content;
}

.category-tab {
    margin-left: 0.4rem; /* Slightly reduced */
}

.category-tab-link {
    display: block;
    padding: 0.6rem 1.2rem; /* Slightly reduced */
    color: hsl(var(--gray-600));
    text-decoration: none;
    border-radius: 0.45rem 0.45rem 0 0; /* Slightly smaller */
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem; /* Slightly smaller */
    border: 2px solid transparent;
    background-color: hsl(var(--gray-100));
}

.category-tab-link:hover {
    color: hsl(var(--red-primary));
    background-color: hsl(var(--gray-200));
    transform: translateY(-1px); /* Reduced movement */
}

.category-tab.active .category-tab-link {
    background-color: white;
    color: hsl(var(--red-primary));
    border-color: hsl(var(--gray-200));
    border-bottom-color: white;
    position: relative;
    z-index: 1;
}

/* Job Header Compact Styling */
.job-details-header {
    background: linear-gradient(135deg, hsl(var(--red-primary) / 0.1), hsl(var(--green-primary) / 0.1));
    border-radius: 0.6rem; /* Slightly smaller */
    padding: 1.5rem; /* Slightly reduced */
    margin-bottom: 1.5rem; /* Slightly reduced */
}

.job-details-header h1.h2 {
    font-size: 1.3rem !important; /* Slightly reduced */
    line-height: 1.3;
    margin-bottom: 0.6rem !important;
    font-weight: 600;
}

.job-details-header h2.h5 {
    font-size: 0.95rem !important; /* Slightly reduced */
    margin-bottom: 0.6rem !important;
    font-weight: 500;
}

/* Company Logo Sizing */
.company-logo-large {
    width: 55px !important; /* Slightly reduced */
    height: 55px !important;
    object-fit: contain;
    border-radius: 0.6rem;
    border: 1px solid hsl(var(--gray-200));
    padding: 0.3rem;
}

.company-logo-large-placeholder {
    width: 80px !important;
    height: 80px !important;
    background: linear-gradient(135deg, hsl(var(--gray-100)), hsl(var(--gray-200)));
    border: 1px solid hsl(var(--gray-200));
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--gray-500));
    font-size: 1.4rem; /* Slightly reduced icon size */
}

/* Badge Styling */
.job-details-header .badge {
    font-size: 0.67rem !important; /* Slightly reduced */
    padding: 0.22rem 0.45rem !important;
    font-weight: 500;
    border-radius: 0.3rem;
    margin-right: 0.3rem;
    margin-bottom: 0.3rem;
}

.job-details-header .badge i {
    font-size: 0.62rem;
}

/* Specific badge colors */
.badge-category {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.badge-city {
    background-color: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #e1bee7;
}

.badge-urgent {
    background-color: #ffebee;
    color: #d32f2f;
    border: 1px solid #ffcdd2;
    animation: pulse 2s infinite;
}

.badge-deadline-approaching {
    background-color: hsl(var(--warning));
    color: white;
    font-size: 0.65rem !important;
    padding: 0.15rem 0.3rem !important;
}

.badge-deadline-passed {
    background-color: hsl(var(--gray-500));
    color: white;
    font-size: 0.65rem !important;
    padding: 0.15rem 0.3rem !important;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Compact spacing */
.job-details-header .me-4 {
    margin-right: 1rem !important; /* Reduced spacing */
}

.job-details-header .gap-2 {
    gap: 0.25rem !important;
}

.job-details-header .mb-3 {
    margin-bottom: 0.75rem !important;
}

/* Salary information - compact */
.salary-info {
    margin-bottom: 0.75rem !important;
}

.salary-info .fw-bold {
    font-size: 0.85rem; /* Reduced font size */
    font-weight: 600;
}

.salary-info i {
    font-size: 0.8rem;
}

/* Meta information - compact */
.job-details-header .text-muted small {
    font-size: 0.7rem !important;
}

.job-details-header .text-muted i {
    font-size: 0.9rem;
}

/* Action buttons - compact */
.job-details-header .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 0.25rem;
}

.job-details-header .btn i {
    font-size: 0.75rem;
}

/* Job cards */
.job-card {
    transition: all 0.3s ease;
    border: 1px solid hsl(var(--gray-200));
    border-radius: 0.45rem; /* Slightly smaller */
    overflow: hidden;
    max-height: 135px; /* Slightly reduced */
    margin-bottom: 0.8rem;
}

.job-card:hover {
    transform: translateY(-1.5px); /* Slightly reduced movement */
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.07);
    border-color: hsl(var(--red-primary) / 0.3);
}

.job-card .card-body {
    padding: 0.7rem; /* Slightly reduced */
}

/* Company logos in cards */
.company-logo {
    width: 60px; /* Slightly reduced from 35px */
    height: 60px;
    border-radius: 0.1rem;
    object-fit: contain;
    background-color: white;
    border: 1px solid hsl(var(--gray-200));
    padding: 0.1rem;
    flex-shrink: 0;
}

.company-logo-placeholder {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 0.3rem;
    background: linear-gradient(135deg, hsl(var(--gray-100)), hsl(var(--gray-200)));
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--gray-500));
    font-size: 1.0rem; /* Slightly smaller icon */
}

/* Job titles */
.job-title {
    color: hsl(var(--gray-800));
    font-weight: 600;
    text-decoration: none;
    font-size: 1.0rem; /* Slightly reduced from 1.1rem */
    line-height: 1.3;
}

.job-title:hover {
    color: hsl(var(--red-primary));
}

.company-name {
    color: hsl(var(--gray-600));
    font-weight: 500;
    font-size: 0.85rem; /* Slightly smaller company name */
    margin-bottom: 0.3rem;
}

/* Buttons - compact */
.btn-morocco {
    background: linear-gradient(135deg, hsl(var(--red-primary)), hsl(var(--green-primary)));
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem; /* Reduced padding */
    border-radius: 0.375rem; /* Smaller radius */
    transition: all 0.3s ease;
    font-size: 0.85rem; /* Smaller font */
}

.btn-morocco:hover {
    transform: translateY(-1px); /* Reduced movement */
    box-shadow: 0 2px 8px rgba(193, 39, 45, 0.3);
    color: white;
}

.btn-apply {
    background-color: hsl(var(--green-primary));
    border: none;
    color: white;
    font-weight: 500;
    padding: 0.375rem 0.75rem; /* Reduced padding */
    border-radius: 0.25rem;
    transition: all 0.3s ease;
    font-size: 0.8rem;
}

.btn-apply:hover {
    background-color: hsl(var(--green-primary) / 0.9);
    transform: translateY(-1px);
    color: white;
}

/* Forms - compact */
.form-control, .form-select {
    font-size: 0.85rem;
    padding: 0.375rem 0.5rem;
}

.form-control:focus {
    border-color: hsl(var(--red-primary));
    box-shadow: 0 0 0 0.15rem hsl(var(--red-primary) / 0.25);
}

.form-select:focus {
    border-color: hsl(var(--red-primary));
    box-shadow: 0 0 0 0.15rem hsl(var(--red-primary) / 0.25);
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.form-text {
    font-size: 0.9rem;
}

/* Search form - compact */
.search-form .form-control, .search-form .form-select {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
}

.search-form .btn {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

/* Timeline for deadline - compact */
.deadline-timeline {
    background: linear-gradient(135deg, hsl(var(--warning) / 0.1), hsl(var(--danger) / 0.1));
    border-radius: 0.375rem;
    padding: 0.75rem; /* Reduced padding */
    margin-bottom: 0.75rem;
}

.deadline-timeline h6 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.deadline-timeline p {
    font-size: 0.85rem;
    margin-bottom: 0;
}

/* Contact info - compact */
#contact-info .card-body {
    padding: 0.75rem;
}

#contact-info .card-header {
    padding: 0.5rem 0.75rem;
}

#contact-info h6 {
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* Alerts - compact */
.alert {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.alert-success {
    background-color: hsl(var(--success) / 0.1);
    border-color: hsl(var(--success) / 0.3);
    color: hsl(var(--success));
}

.alert-danger {
    background-color: hsl(var(--danger) / 0.1);
    border-color: hsl(var(--danger) / 0.3);
    color: hsl(var(--danger));
}

.alert-warning {
    background-color: hsl(var(--warning) / 0.1);
    border-color: hsl(var(--warning) / 0.3);
    color: hsl(123 29% 31%);
}

/* Mobile responsiveness - compact */
@media (max-width: 768px) {
    body {
        font-size: 0.85rem;
    }
    
    .navbar {
        padding: 0.25rem 0.75rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .category-tabs {
        margin-bottom: 1rem;
    }
    
    .category-tab-link {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .job-details-header {
        padding: 0.75rem;
    }
    
    .job-details-header h1.h2 {
        font-size: 1.1rem !important;
    }
    
    .job-details-header h2.h5 {
        font-size: 0.9rem !important;
    }
    
    .company-logo-large,
    .company-logo-large-placeholder {
        width: 32px !important;
        height: 32px !important;
    }
    
    .job-details-header .me-4 {
        margin-right: 0.75rem !important;
    }
    
    .job-details-header .badge {
        font-size: 0.6rem !important;
        padding: 0.15rem 0.3rem !important;
    }
    
    .job-details-header .btn {
        font-size: 1rem;
        padding: 0.3rem 0.9rem;
    }
    
    .job-card {
        max-height: none;
        min-height: 100px;
    }
    
    .job-card .card-body {
        padding: 0.5rem !important;
    }
    
    .company-logo,
    .company-logo-placeholder {
        width: 50px;
        height: 55px;
    }
    
    .job-title {
        font-size: 0.9rem;
    }
    
    .company-name {
        font-size: 0.9rem;
    }
    
    .search-form .col-lg-4,
    .search-form .col-lg-2 {
        margin-bottom: 0.5rem;
    }
    
    .search-form .btn {
        width: 100%;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    body {
        font-size: 0.8rem;
    }
    
    .job-details-header h1.h2 {
        font-size: 1rem !important;
    }
    
    .company-logo-large,
    .company-logo-large-placeholder {
        width: 30px !important;
        height: 35px !important;
    }
    
    .job-details-header .badge {
        font-size: 0.55rem !important;
        padding: 0.1rem 0.25rem !important;
    }
    
    .job-card {
        margin-bottom: 0.5rem;
    }
    
    .job-title {
        font-size: 0.85rem;
    }
    
    .company-name {
        font-size: 0.7rem;
    }
    
    .job-details-header .d-flex.flex-column.gap-2 {
        width: 100%;
        margin-top: 0.75rem;
    }
}

/* Arabic text support */
.job-details-header [lang="ar"],
.job-details-header *:lang(ar) {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    direction: rtl;
    text-align: right;
}

.job-details-header .badge:lang(ar) {
    margin-left: 0.25rem;
    margin-right: 0;
}

/* Ensure icons maintain proper alignment */
.job-details-header i {
    vertical-align: middle;
    line-height: 1;
}

/* Layout preservation */
.job-details-header .d-flex.align-items-start {
    align-items: flex-start !important;
}

.job-details-header .flex-grow-1 {
    flex: 1 1 auto !important;
}

.job-details-header .d-flex.flex-wrap {
    margin-bottom: 0.5rem !important;
}

/* Color consistency */
.job-details-header .text-muted {
    color: hsl(var(--gray-500)) !important;
}

.job-details-header .text-success {
    color: hsl(var(--success)) !important;
}

/* Empty states - compact */
.empty-state {
    padding: 2rem 1rem; /* Reduced padding */
    text-align: center;
    color: hsl(var(--gray-500));
}

.empty-state i {
    font-size: 3rem; /* Reduced icon size */
    margin-bottom: 0.75rem;
    color: hsl(var(--gray-400));
}

/* Custom scrollbar - compact */
::-webkit-scrollbar {
    width: 6px; /* Thinner scrollbar */
    height: 6px;
}

::-webkit-scrollbar-track {
    background: hsl(var(--gray-200));
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--gray-400));
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--gray-500));
}

/* Loading animation - compact */
.loading {
    display: inline-block;
    width: 16px; /* Smaller loading spinner */
    height: 16px;
    border: 2px solid hsl(var(--gray-300));
    border-radius: 50%;
    border-top-color: hsl(var(--red-primary));
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Pagination - compact */
.pagination {
    margin-bottom: 0.5rem;
}

.page-link {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

/* Footer - compact */
footer {
    padding: 1rem 0;
}

footer h6 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

footer p, footer .small {
    font-size: 0.75rem;
}

.social-links a {
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

/* Text utilities */
.text-light-50 {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* Morocco flag animation - unchanged */
.morocco-flag {
    display: inline-flex;
    align-items: center;
}

.morocco-flag span {
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}
