/**
 * Reusable component styles (badges, progress bars, data tables, buttons).
 *
 * @package Careers_Theme
 * @since   1.0.0
 */

:root {
    --brand: #0f766e;
    --brand-strong: #0b5f55;
    --brand-soft: #e0f2f1;
    --accent: #f59e0b;
    --ink: #0f172a;
    --muted: #5b6472;
    --surface: #ffffff;
    --surface-2: #f6f4f0;
    --border: #e6e1d8;
    --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.08);
    --shadow-lite: 0 4px 12px rgba(15, 23, 42, 0.06);
}

/* ==========================================================================
   Status badges
   ========================================================================== */

.careers-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

/* Green: active, completed, hired */
.careers-badge--active,
.careers-badge--completed,
.careers-badge--hired {
    background: #dcfce7;
    color: #166534;
}

/* Yellow / amber: in_progress, reviewing, interviewed */
.careers-badge--in_progress,
.careers-badge--reviewing,
.careers-badge--interviewed {
    background: #fef3c7;
    color: #92400e;
}

/* Red: terminated, rejected */
.careers-badge--terminated,
.careers-badge--rejected {
    background: #fee2e2;
    color: #991b1b;
}

/* Gray: submitted, assigned */
.careers-badge--submitted,
.careers-badge--assigned {
    background: #f3f4f6;
    color: #4b5563;
}

/* ==========================================================================
   Progress bar
   ========================================================================== */

.careers-progress {
    width: 100%;
    max-width: 220px;
}

.careers-progress__track {
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
}

.careers-progress__fill {
    height: 100%;
    border-radius: 5px;
    background: #3b82f6;
    transition: width .3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 4px;
    min-width: 0;
}

.careers-progress--complete .careers-progress__fill {
    background: #22c55e;
}

.careers-progress--half .careers-progress__fill {
    background: #3b82f6;
}

.careers-progress--started .careers-progress__fill {
    background: #f59e0b;
}

.careers-progress__text {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.careers-progress__label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* ==========================================================================
   Data table
   ========================================================================== */

.careers-dt-wrap {
    margin-bottom: 16px;
}

.careers-dt-toolbar {
    margin-bottom: 12px;
}

.careers-dt-search {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.careers-dt-search:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

.careers-dt-scroll {
    overflow-x: auto;
}

.careers-dt {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.careers-dt th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    background: #fbfaf8;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

.careers-dt--sortable th {
    cursor: pointer;
}

.careers-dt--sortable th:hover {
    color: #3b82f6;
}

.careers-dt-sort-icon::after {
    content: "⇅";
    margin-left: 4px;
    font-size: 10px;
    opacity: .4;
}

.careers-dt th.sort-asc .careers-dt-sort-icon::after { content: "↑"; opacity: 1; }
.careers-dt th.sort-desc .careers-dt-sort-icon::after { content: "↓"; opacity: 1; }

.careers-dt td {
    padding: 10px 12px;
    font-size: 14px;
    border-bottom: 1px solid #efeae2;
    vertical-align: middle;
}

.careers-dt tbody tr:last-child td {
    border-bottom: none;
}

.careers-dt tbody tr:hover {
    background: #f9fafb;
}

.careers-dt-empty-row td {
    text-align: center;
    padding: 32px 12px;
    color: #9ca3af;
}

/* Pagination */
.careers-dt-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 12px;
}

.careers-dt-pagination button {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
}

.careers-dt-pagination button.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.careers-dt-pagination button:hover:not(.active) {
    background: #f3f4f6;
}

.careers-dt-pagination button:disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* ==========================================================================
   Responsive table
   ========================================================================== */

@media (max-width: 640px) {
    .careers-dt,
    .careers-dt thead,
    .careers-dt tbody,
    .careers-dt th,
    .careers-dt td,
    .careers-dt tr {
        display: block;
    }

    .careers-dt thead {
        display: none;
    }

    .careers-dt td {
        padding: 8px 12px;
        text-align: right;
        border-bottom: none;
    }

    .careers-dt td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: #374151;
    }

    .careers-dt tbody tr {
        margin-bottom: 12px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 8px 0;
    }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.careers-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.5;
}

.careers-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

/* Primary button */
.careers-btn--primary {
    background: var(--brand);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(15, 118, 110, 0.24);
}

.careers-btn--primary:hover {
    background: var(--brand-strong);
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.3);
    transform: translateY(-1px);
}

.careers-btn--primary:active {
    transform: translateY(0);
}

/* Secondary button */
.careers-btn--secondary {
    background: #ffffff;
    color: var(--brand);
    border: 1px solid var(--brand);
}

.careers-btn--secondary:hover {
    background: var(--brand-soft);
    border-color: var(--brand-strong);
}

/* Success button */
.careers-btn--success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.careers-btn--success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

/* Danger button */
.careers-btn--danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.careers-btn--danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

/* Warning button */
.careers-btn--warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.careers-btn--warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

/* Outline button */
.careers-btn--outline {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--border);
}

.careers-btn--outline:hover {
    background: var(--surface-2);
    border-color: #c9c3b8;
}

/* Ghost button */
.careers-btn--ghost {
    background: transparent;
    color: #6b7280;
    border: none;
}

.careers-btn--ghost:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Button sizes */
.careers-btn--sm {
    padding: 6px 14px;
    font-size: 13px;
}

.careers-btn--lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* Button block */
.careers-btn--block {
    display: block;
    width: 100%;
}

/* Disabled state */
.careers-btn:disabled,
.careers-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button group */
.careers-btn-group {
    display: inline-flex;
    gap: 8px;
}

.careers-btn-group--block {
    display: flex;
}

.careers-btn-group--block .careers-btn {
    flex: 1;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.careers-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.careers-modal.active {
    display: flex;
}

.careers-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: careers-fade-in 0.2s ease;
}

.careers-modal-container {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    animation: careers-slide-up 0.25s ease;
    z-index: 1;
}

.careers-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.careers-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.careers-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.15s ease;
}

.careers-modal-close:hover {
    color: #374151;
}

.careers-modal-body {
    padding: 24px;
}

.careers-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

@keyframes careers-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes careers-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal sizes */
.careers-modal--sm .careers-modal-container {
    max-width: 400px;
}

.careers-modal--md .careers-modal-container {
    max-width: 600px;
}

.careers-modal--lg .careers-modal-container {
    max-width: 900px;
}

.careers-modal--xl .careers-modal-container {
    max-width: 1200px;
}

/* ==========================================================================
   Tabs
   ========================================================================== */

.careers-tabs {
    margin-bottom: 24px;
}

.careers-tabs-nav {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    gap: 4px;
}

.careers-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6b7280;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: -2px;
}

.careers-tab:hover {
    color: #374151;
    background: #f9fafb;
}

.careers-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.careers-tab-content {
    display: none;
    padding: 20px 0;
}

.careers-tab-content.active {
    display: block;
    animation: careers-fade-in 0.2s ease;
}

/* ==========================================================================
   Tooltip
   ========================================================================== */

.careers-tooltip {
    position: relative;
    display: inline-block;
}

.careers-tooltip-text {
    visibility: hidden;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #ffffff;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.careers-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.careers-tooltip:hover .careers-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ==========================================================================
   Dropdown Menu
   ========================================================================== */

.careers-dropdown {
    position: relative;
    display: inline-block;
}

.careers-dropdown-toggle {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.careers-dropdown-toggle:hover {
    background: #f9fafb;
}

.careers-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    z-index: 1000;
    animation: careers-slide-up 0.15s ease;
}

.careers-dropdown.active .careers-dropdown-menu {
    display: block;
}

.careers-dropdown-item {
    display: block;
    padding: 10px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.1s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.careers-dropdown-item:hover {
    background: #f3f4f6;
}

.careers-dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

/* ==========================================================================
   Form Components
   ========================================================================== */

.careers-form-group {
    margin-bottom: 20px;
}

.careers-label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.careers-label-required::after {
    content: "*";
    color: #ef4444;
    margin-left: 4px;
}

.careers-input,
.careers-textarea,
.careers-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.15s ease;
}

.careers-input:focus,
.careers-textarea:focus,
.careers-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.careers-input.error,
.careers-textarea.error,
.careers-select.error {
    border-color: #ef4444;
}

.careers-textarea {
    min-height: 100px;
    resize: vertical;
}

.careers-help-text {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: #6b7280;
}

.careers-error-text {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: #ef4444;
}

/* Checkbox and Radio */
.careers-checkbox,
.careers-radio {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.careers-checkbox input[type="checkbox"],
.careers-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
}

.careers-checkbox label,
.careers-radio label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
}

/* Toggle Switch */
.careers-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.careers-toggle-input {
    position: absolute;
    opacity: 0;
}

.careers-toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background: #d1d5db;
    border-radius: 24px;
    transition: background 0.15s ease;
    margin-right: 10px;
}

.careers-toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.careers-toggle-input:checked + .careers-toggle-slider {
    background: #3b82f6;
}

.careers-toggle-input:checked + .careers-toggle-slider::before {
    transform: translateX(24px);
}

.careers-toggle-label {
    font-size: 14px;
    color: #374151;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.dashicons.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}
