@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;600;700&display=swap');

/* =================================================================== */
/* =================== FRONTEND & GENERAL STYLES ===================== */
/* =================================================================== */

/* Estilos generales de los wrappers */
.job-board-form, .job-listings-wrapper, #job-dashboard-wrapper, .single-job-listing-wrapper {
    width: 100%;
    box-sizing: border-box;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
}
.job-board-notice { padding: 1rem; border-radius: 6px; margin-bottom: 1.5rem; }
.job-board-notice.success { background-color: #e7f6ff; color: #004085; border: 1px solid #b8daff; }
.job-board-notice.warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.job-board-notice.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.job-board-notice.warning a { color: #856404; font-weight: 600; text-decoration: underline; }

/* Formulario de envío */
.job-board-form fieldset { border: none; padding: 0; margin-bottom: 1.5rem; }
.job-board-form label { display: block; font-weight: 600; }
.job-board-form label .required { color: #c82333; font-weight: bold; margin-left: 4px; }
.job-board-form label.checkbox-label { display: inline-block; font-weight: normal; margin-left: 5px; }
.job-board-form input[type='text'], .job-board-form input[type='date'], .job-board-form input[type='url'], .job-board-form input[type='email'], .job-board-form select, .job-board-form textarea { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; }
.job-board-form button, .job-filters button { background: #7628bf; color: #fff; border: none; padding: 12px 25px; border-radius: 6px; cursor: pointer; font-size: 16px; font-weight: 600; }
.job-board-form .job-options {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}
.job-board-form .job-options > div {
    display: flex;
    align-items: center;
}

/* Editor TinyMCE */
.wp-editor-wrap .mce-toolbar-grp .mce-btn { background-color: #7628bf !important; border-color: #6a24ac !important; border-radius: 4px !important; margin: 2px !important; }
.wp-editor-wrap .mce-toolbar-grp .mce-btn:hover, .wp-editor-wrap .mce-toolbar-grp .mce-btn:focus { background-color: #66A9DF !important; border-color: #5aa0d1 !important; }
.wp-editor-wrap .mce-toolbar-grp .mce-btn i.mce-ico { color: #fff !important; font-size: 16px !important; }
.wp-editor-wrap .mce-toolbar-grp .mce-btn button { padding: 2px 6px !important; }

/* === NEW JOB LISTING STYLES (FROM SCRATCH) === */
.job-listings { list-style: none; padding: 0; margin: 0; }
.job-listing { border-bottom: 1px solid #eee; }
.job-listing:last-child { border-bottom: none; }

.job-listing a {
    display: flex;
    align-items: center; /* Vertically align logo and content */
    gap: 1.5rem;
    padding: 1.5rem 0;
    text-decoration: none;
    color: inherit;
}

.job-listing-logo {
    flex-shrink: 0;
}

.job-listing-logo img {
    width: 80px;  /* Slightly larger logo */
    height: 80px;
    border-radius: 8px;
    object-fit: contain;
}

.job-listing-logo-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background-color: #f1f1f1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.job-listing-logo-placeholder .dashicons {
    font-size: 40px;
    color: #a0a5aa;
}

.job-listing-content {
    display: flex;
    flex-direction: column; /* Main axis is vertical */
    justify-content: center; /* Vertically center the text lines */
    gap: 0.25rem; /* Reduced space between title/company and meta details */
    flex-grow: 1; /* Takes up remaining space */
    min-width: 0; /* Prevents flex items from overflowing */
}

.job-info {
    /* No special styles needed, inherits from content */
}

.job-title {
    font-size: 1.1rem; /* Slightly larger title */
    font-weight: 600;
    color: #7628bf;
    margin: 0;
    line-height: 1.3;
    
    /* Truncate to 2 lines */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
            line-clamp: 2;
    -webkit-box-orient: vertical;
}

.company-name {
    font-size: 0.9rem;
    color: #555;
    margin-top: 0; /* Removed margin for compactness */
}

.job-meta {
    display: flex;
    flex-wrap: wrap; /* Allows items to wrap onto the next line */
    gap: 0.5rem 1rem; /* Vertical and horizontal gap */
    margin-top: 0.25rem; /* Reduced space above the meta block */
    font-size: 0.85rem; /* Smaller font for details */
    color: #6c757d;
}

.job-meta span {
    display: flex;
    align-items: center;
}

.job-meta span .dashicons {
    color: #66A9DF !important;
    margin-right: 6px;
    font-size: 18px;
}
/* === END OF NEW STYLES === */


.job-filters { background: #f8f9fa; padding: 1.5rem; border-radius: 8px; margin-bottom: 2rem; }
.job-filters .search-fields { display: flex; gap: 1rem; }
.job-filters .search-fields input { flex-grow: 1; }
.job-filters .filter-options { 
    margin-top: 1rem; 
    display: flex; 
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}
.job-filters .work-type-options,
.job-filters .job-type-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}

/* Dashboard & Statuses */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.dashboard-header .button { background: #7628bf; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px; }
.job-dashboard-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.job-dashboard-table th, .job-dashboard-table td { padding: 1rem; text-align: left; border-bottom: 1px solid #eee; }
.job-dashboard-table .actions-column a { color: #555; text-decoration: none; margin-right: 10px; }
.job-dashboard-table .actions-column a .dashicons-trash { color: #a00; }
.job-dashboard-table .actions-column a .dashicons-yes-alt { color: #28a745; }
.job-dashboard-table .actions-column a .dashicons-archive { color: #6c757d; }
.job-dashboard-table .actions-column a:hover .dashicons { color: #000; }
.status-badge { display: inline-block; padding: 0.4em 0.8em; font-size: 75%; font-weight: 700; line-height: 1; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: 6px; color: #fff; box-sizing: border-box; }
.job-dashboard-table .status-publish { background-color: #28a745; }
.status-filled { background-color: #6c757d; }

/* Paginación */
.jb-pagination { margin-top: 2rem; text-align: center; }
.jb-pagination .page-numbers { padding: 8px 12px; margin: 0 2px; border: 1px solid #ddd; text-decoration: none; color: #7628bf; border-radius: 4px; }
.jb-pagination .page-numbers.current, .jb-pagination .page-numbers:hover { background-color: #7628bf; color: #fff; border-color: #7628bf; }

/* Vista individual (en Modal) */
.jb-modal-content .single-job-listing-wrapper { box-shadow: none; padding: 0; }
.single-job-listing-wrapper { display: flex; flex-wrap: wrap; gap: 2rem; }
.job-description { flex: 3; min-width: 300px; }
.job-details-sidebar { flex: 1; min-width: 300px; }
.job-details-box { background: #f8f9fa; padding: 1.5rem; border-radius: 8px; margin-bottom: 1.5rem; }
.job-details-sidebar .company-logo-wrapper { text-align: center; margin-bottom: 1rem; }
.job-details-sidebar .company-logo-wrapper img { width: 80px; height: 80px; border-radius: 50%; object-fit: contain; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.job-details-sidebar .job-listing-logo-placeholder { width: 80px; height: 80px; border-radius: 50%; margin: 0 auto; }
.job-details-sidebar .company-title-sidebar { text-align: left; margin-top: 0; margin-bottom: 1rem; }
.job-details-sidebar .company-meta { justify-content: flex-start; }
.sidebar-divider { border: 0; border-top: 1px solid #eee; margin: 1.5rem 0; }
.job-meta-details div, .company-meta { display: flex; align-items: center; gap: 8px; }
.job-meta-details div { margin-bottom: 0.75rem; }
.job-details-box div .dashicons { vertical-align: middle; }
.job-details-box .company-meta { margin-top: 0.5rem; }
.job-details-box .company-meta .dashicons { color: #7628bf; }
.application-buttons { display: flex; flex-direction: column; gap: 1rem; }
.application-buttons .button { display: block; width: 100%; text-align: center; padding: 15px; border-radius: 6px; text-decoration: none; font-weight: 600; border: none; cursor: pointer; }
.btn-apply { background: #7628bf; color: #fff; }
.btn-guidance { background: #66A9DF; color: #fff; }
.job-filled-notice {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}
.job-filled-notice .dashicons {
    font-size: 1.5rem;
    color: #664d03;
    height: auto;
    width: auto;
}
.job-filled-notice p {
    margin: 0;
    color: #664d03;
}

/* Modal */
.jb-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 10000; display: none; justify-content: center; align-items: center; padding: 1rem; box-sizing: border-box; }
.jb-modal-overlay.visible { display: flex; }
.jb-modal { background: #fff; padding: 2rem; border-radius: 8px; max-width: 900px; width: 100%; position: relative; max-height: 90vh; overflow-y: auto; }
#jb-application-modal.jb-modal { max-width: 900px; }
.jb-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 2rem;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.jb-modal-close:hover {
    color: #000;
}
#jb-application-form .form-row { display: flex; gap: 1.5rem; }
#jb-application-form .form-half { flex: 1; }
#jb-application-form fieldset, #jb-edit-job-modal .job-board-form fieldset { margin-bottom: 1.2rem; border: 1px solid #eee; padding: 1rem 1.5rem; border-radius: 8px;}
#jb-application-form input[type="text"], #jb-application-form input[type="email"], #jb-application-form input[type="tel"], #jb-application-form input[type="date"], #jb-application-form select, #jb-application-form textarea { width: 100%; box-sizing: border-box; }
#jb-application-form label, #jb-edit-job-modal .job-board-form label { margin-bottom: 0.5rem; }
.jb-modal form label { display: block; font-weight: 600; margin-bottom: .8rem; }
#jb-application-modal button, #jb-edit-job-form button, #jb-admin-add-job-form button {
    background: #7628bf; color: #fff; border: none; padding: 12px 25px; border-radius: 6px; cursor: pointer; font-size: 16px; font-weight: 600;
}
.jb-confirm-modal-overlay { z-index: 10001; }
.jb-confirm-modal { max-width: 400px; text-align: left; }
.jb-confirm-modal h4 { margin-top: 0; font-size: 1.2rem;}
.jb-confirm-modal p { margin-bottom: 1.5rem; }
.jb-confirm-modal .confirm-actions { margin-top: 1.5rem; display: flex; justify-content: flex-end; gap: 1rem; }
.jb-confirm-modal .confirm-actions .button-primary, .jb-confirm-modal .confirm-actions .button-secondary { border: none; border-radius: 5px; cursor: pointer; padding: 10px 25px; font-weight: 600;}
.jb-confirm-modal .confirm-actions .button-primary { background-color: #c82333; color: white; }
.jb-confirm-modal .confirm-actions .button-secondary { background-color: #ccc; color: #333; }
.jb-confirm-modal .jb-modal-close.button-secondary { position: static; font-size: inherit; font-weight: 600; color: #333; line-height: inherit; padding: 10px 25px; }
.jb-form-notice-wrapper { margin-top: 1rem; }
#jb-application-form .field-error { border: 1px solid #c82333; }

@media (max-width: 768px) {
    .job-filters .search-fields, .job-filters .filter-options { flex-direction: column; gap: 1rem; align-items: stretch; }
    .job-listing a {
        position: relative;
        display: block;
        padding: 1rem;
    }
    .job-listing .job-listing-logo {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
     .job-listing .job-listing-logo img, .job-listing .job-listing-logo-placeholder {
        width: 40px;
        height: 40px;
    }
    .job-listing .job-listing-content {
        padding-right: 50px;
        flex-direction: column;
        align-items: flex-start;
    }
    .job-listing .job-meta {
        margin-top: 1rem;
        margin-left: 0;
        gap: 0.5rem;
        flex-direction: column;
        align-items: flex-start;
    }
    #jb-application-form .form-row { flex-direction: column; gap: 0; }
    #jb-application-form .form-row .form-half { margin-bottom: 1.2rem; }
    .single-job-listing-wrapper { flex-direction: column; }
}


/* =================================================================== */
/* ======================== ADMIN STYLES ============================= */
/* =================================================================== */

/* General styles for the admin dashboard wrapper */
.job-board-admin-dashboard {
    width: 100%;
    box-sizing: border-box;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    font-family: 'Raleway', sans-serif;
}

.wrap .card {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 1px 1.5rem 1.5rem;
    margin-top: 1rem;
}

/* Apply scroll to the tab content area to handle wide tables */
.job-board-admin-dashboard .jb-admin-tab-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.job-board-admin-dashboard .job-dashboard-table {
    table-layout: auto;
    width: 100%;
}

.job-board-admin-dashboard .job-dashboard-table th,
.job-board-admin-dashboard .job-dashboard-table td {
    white-space: nowrap !important;
    word-break: normal !important;
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

/* Admin Dashboard Specific styles */
.jb-admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid #eee; }
.jb-admin-header h2 { margin: 0; }
.jb-admin-header-actions .button { background: #66A9DF; text-decoration: none; color: white; padding: 8px 15px; border-radius: 5px; margin-left: 10px; cursor: pointer; }
.jb-admin-tabs { display: flex; list-style: none; padding: 0; margin: 0 0 1.5rem 0; border-bottom: 2px solid #ddd; }
.jb-admin-tabs li a { padding: 10px 20px; display: block; text-decoration: none; color: #555; font-weight: 600; }
.jb-admin-tabs li.active a { color: #7628bf; border-bottom: 2px solid #7628bf; }
.jb-admin-tabs li a .dashicons { margin-right: 8px; vertical-align: text-bottom; }
.jb-admin-tab-content .tab-pane { display: none; }
.jb-admin-tab-content .tab-pane.active { display: block; }

@media (max-width: 768px) {
    .jb-admin-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .jb-admin-tabs { flex-wrap: wrap; }
}

