/* Jobs Arena Kenya - Main Stylesheet */
/* Color palette inspired by Kenyan flag: black, red, green, white */

:root {
    --primary: #006600; /* Green */
    --primary-dark: #004d00;
    --secondary: #bb0000; /* Red */
    --dark: #1a1a1a;
    --gray: #666;
    --light-gray: #f5f5f5;
    --border: #e0e0e0;
    --white: #ffffff;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --radius: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: #fafafa;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Top Bar */
.top-bar {
    background: var(--dark);
    color: var(--white);
    font-size: 0.875rem;
    padding: 8px 0;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.top-bar span, .top-bar a {
    color: rgba(255,255,255,0.85);
    margin-right: 15px;
}

.top-bar a:hover {
    color: var(--white);
}

.top-bar .btn-sm {
    background: var(--primary);
    color: white !important;
    padding: 4px 12px;
    border-radius: 4px;
    margin-right: 0;
}

/* Header */
.main-header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
}

.logo img {
    max-height: 50px;
    width: auto;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.logo-text i {
    margin-right: 8px;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 5px;
}

.main-nav a {
    color: var(--dark);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 500;
}

.main-nav a:hover,
.main-nav a.active {
    background: var(--primary);
    color: white;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #003300 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

.search-box {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.search-form {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr auto;
    gap: 12px;
}

.search-form input,
.search-form select {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.search-form button {
    background: var(--secondary);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.search-form button:hover {
    background: #990000;
}

/* Stats */
.stats-bar {
    background: white;
    padding: 30px 0;
    box-shadow: var(--shadow);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    text-align: center;
}

.stat-item h3 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 5px;
}

.stat-item p {
    color: var(--gray);
}

/* Sections */
.section {
    padding: 60px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
}

.section-title h2 {
    font-size: 2rem;
    color: var(--dark);
    margin-bottom: 10px;
}

.section-title p {
    color: var(--gray);
}

/* Job Cards */
.jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 25px;
}

.job-card {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid transparent;
}

.job-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    border-color: var(--primary);
}

.job-card.featured {
    border-left: 4px solid var(--secondary);
}

.job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.job-card h3 {
    font-size: 1.15rem;
    margin-bottom: 5px;
}

.job-card h3 a {
    color: var(--dark);
}

.job-card h3 a:hover {
    color: var(--primary);
}

.job-company {
    color: var(--primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 15px 0;
    font-size: 0.875rem;
    color: var(--gray);
}

.job-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.job-salary {
    color: var(--primary);
    font-weight: 600;
    font-size: 1rem;
}

.job-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tag {
    background: var(--light-gray);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--gray);
}

.tag.remote {
    background: #e8f5e9;
    color: var(--primary);
}

.tag.featured {
    background: #ffebee;
    color: var(--secondary);
}

/* Categories */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.category-card {
    background: white;
    padding: 25px 20px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.category-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.category-card h4 {
    margin-bottom: 5px;
}

.category-card span {
    color: var(--gray);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-align: center;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #990000;
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,102,0,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-card {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 500px;
    margin: 40px auto;
}

.form-card h2 {
    margin-bottom: 25px;
    text-align: center;
}

/* Job Detail */
.job-detail {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.job-detail-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 25px;
    margin-bottom: 25px;
}

.job-detail h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.job-sidebar {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
}

.job-sidebar .apply-btn {
    margin-bottom: 20px;
}

.sidebar-info {
    list-style: none;
}

.sidebar-info li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}

.sidebar-info li:last-child {
    border-bottom: none;
}

/* Candidates / Employers grids */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.profile-card {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.profile-card:hover {
    transform: translateY(-3px);
}

.profile-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    background: var(--light-gray);
}

.profile-avatar.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--gray);
    margin: 0 auto 15px;
}

/* Pagination */
.pagination {
    margin-top: 40px;
    text-align: center;
}

.pagination-info {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.pagination ul {
    display: inline-flex;
    list-style: none;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.pagination a {
    display: block;
    padding: 10px 16px;
    background: white;
    border-radius: var(--radius);
    color: var(--dark);
    box-shadow: var(--shadow);
    text-decoration: none;
    min-width: 42px;
}

.pagination .active a,
.pagination a:hover {
    background: var(--primary);
    color: white;
}

.pagination .ellipsis span {
    display: block;
    padding: 10px 8px;
    color: #999;
}

/* Flash messages */
.flash-message {
    padding: 15px 0;
    position: relative;
}

.flash-success { background: #d4edda; color: #155724; }
.flash-error { background: #f8d7da; color: #721c24; }
.flash-warning { background: #fff3cd; color: #856404; }
.flash-info { background: #d1ecf1; color: #0c5460; }

.flash-close {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.6;
}

/* Footer */
.main-footer {
    background: var(--dark);
    color: rgba(255,255,255,0.8);
    padding: 60px 0 0;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.5fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h3, .footer-col h4 {
    color: white;
    margin-bottom: 20px;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col a {
    color: rgba(255,255,255,0.7);
}

.footer-col a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.social-links a:hover {
    background: var(--primary);
}

.footer-map {
    height: 180px;
    border-radius: var(--radius);
    margin-top: 15px;
    background: #333;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 20px 0;
    text-align: center;
    font-size: 0.875rem;
}

/* Layout helpers */
.page-header {
    background: linear-gradient(135deg, var(--primary), #003300);
    color: white;
    padding: 40px 0;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 2rem;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
}

.three-col {
    display: grid;
    grid-template-columns: 250px 1fr 280px;
    gap: 25px;
}

/* Filters sidebar */
.filters {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.filters h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th, .table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--light-gray);
    font-weight: 600;
}

.table tr:hover {
    background: #f9f9f9;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: #e8f5e9; color: var(--primary); }

/* Admin specific */
.admin-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--dark);
    color: white;
    padding: 20px 0;
}

.admin-sidebar .logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.admin-sidebar .logo a {
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
}

.admin-menu {
    list-style: none;
}

.admin-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
}

.admin-menu a:hover,
.admin-menu a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.admin-content {
    padding: 30px;
    background: #f0f2f5;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 2rem;
    color: var(--primary);
}

.stat-card p {
    color: var(--gray);
    margin-top: 5px;
}

/* Responsive */
@media (max-width: 992px) {
    .search-form {
        grid-template-columns: 1fr 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    .two-col, .three-col {
        grid-template-columns: 1fr;
    }
    .stats-grid, .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .admin-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: var(--shadow);
    }
    .main-nav.active {
        display: block;
    }
    .main-nav ul {
        flex-direction: column;
        padding: 15px;
    }
    .mobile-toggle {
        display: block;
    }
    .search-form {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .hero h1 {
        font-size: 1.8rem;
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid, .stats-cards {
        grid-template-columns: 1fr;
    }
}

/* ========== Performance & mobile enhancements ========== */
img, video {
    max-width: 100%;
    height: auto;
}

img[loading="lazy"] {
    content-visibility: auto;
}

table.table {
    width: 100%;
    border-collapse: collapse;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.main-header {
    position: relative;
    z-index: 100;
}

/* Larger touch targets on mobile */
@media (max-width: 768px) {
    .btn, button, .main-nav a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .main-nav a {
        width: 100%;
        justify-content: flex-start;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
    }
    .mobile-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 1px solid var(--border);
        background: var(--white);
        border-radius: var(--radius);
        font-size: 1.25rem;
        cursor: pointer;
    }
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        box-shadow: var(--shadow);
        max-height: min(70vh, 480px);
        overflow-y: auto;
        z-index: 200;
    }
    .main-nav.active {
        display: block;
    }
    .header-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 0;
    }
    .page-header {
        padding: 28px 0;
    }
    .page-header h1 {
        font-size: 1.45rem;
        line-height: 1.3;
    }
    .jobs-grid {
        grid-template-columns: 1fr;
    }
    .profile-grid {
        grid-template-columns: 1fr;
    }
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .job-detail,
    .container .job-detail {
        padding: 16px !important;
    }
    .table {
        font-size: 0.875rem;
    }
    .top-bar {
        font-size: 0.75rem;
        text-align: center;
    }
    .top-bar .container {
        justify-content: center;
    }
    input, select, textarea {
        font-size: 16px; /* prevents iOS zoom on focus */
        max-width: 100%;
    }
    .form-row {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    /* Stack analytics / dashboard grids */
    .analytics-grid,
    .emp-dash-grid {
        grid-template-columns: 1fr !important;
    }
    body {
        overflow-x: hidden;
    }
    .container {
        padding: 0 14px;
    }
    .footer-map {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem;
    }
    .btn-block {
        width: 100%;
    }
    .stat-card h3 {
        font-size: 1.5rem;
    }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Print: hide chrome */
@media print {
    .top-bar, .main-header, .main-footer, .mobile-toggle, .toolbar {
        display: none !important;
    }
}
