/* ==========================================================================
   iframe-Friendly Careers Page Styles
   Designed to be embedded in keys-recruiters.com/jobs
   ========================================================================== */

/* Reset and base styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background: #fff;
}

/* Container */
.iframe-content {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Hero section */
.hero-section {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
}

.hero-title {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 15px 0;
    color: #222;
}

.hero-subtitle {
    font-size: 18px;
    color: #666;
    margin: 0;
}

/* Search section */
.search-section {
    margin-bottom: 30px;
}

.search-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .search-grid {
        grid-template-columns: 1fr;
    }

    .jobs-grid {
        grid-template-columns: 1fr;
    }

    .pagination-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .pagination-nav {
        width: 100%;
        justify-content: center;
    }
}

.search-input,
.filter-select {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}

.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Active filters */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 15px;
}

.filter-label {
    font-weight: 500;
    color: #666;
}

.filter-tag {
    background: #e9ecef;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-remove {
    color: #666;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
}

.filter-remove:hover {
    color: #dc3545;
}

.clear-filters {
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
}

.clear-filters:hover {
    text-decoration: underline;
}

/* Job cards */
.jobs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.job-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.job-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

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

.job-title {
    font-size: 20px;
    font-weight: 600;
    color: #222;
    margin: 0;
    flex: 1;
}

.job-title-link {
    color: #007bff;
    text-decoration: none;
}

.job-title-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

.job-type-badge {
    background: #e7f3ff;
    color: #0066cc;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.job-card-body {
    margin-bottom: 20px;
}

.job-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.job-icon {
    flex-shrink: 0;
}

.job-excerpt {
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    margin: 15px 0 0 0;
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.job-excerpt p {
    margin: 8px 0;
}

.job-excerpt ul,
.job-excerpt ol {
    margin: 8px 0;
    padding-left: 20px;
}

.job-excerpt li {
    margin: 4px 0;
}

.job-excerpt br {
    display: block;
    content: "";
    margin: 4px 0;
}

.job-excerpt strong,
.job-excerpt b {
    font-weight: 600;
    color: #333;
}

.job-card-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
    text-align: center;
}

.btn:hover {
    background: #0056b3;
}

.btn-primary {
    background: #007bff;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: transparent;
    color: #007bff;
    border: 1px solid #007bff;
}

.btn-secondary:hover {
    background: #007bff;
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: #007bff;
    border: 1px solid #007bff;
}

.btn-outline:hover {
    background: #007bff;
    color: #fff;
}

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

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state-icon {
    margin-bottom: 20px;
    color: #ccc;
}

.empty-state-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.empty-state-text {
    font-size: 16px;
    color: #666;
}

/* Job count display */
.job-count-display {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
    font-weight: 500;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid #e0e0e0;
    gap: 20px;
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.pagination-nav {
    display: flex;
    align-items: center;
}

.pagination-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.per-page-select {
    padding: 6px 30px 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.per-page-select:hover {
    border-color: #007bff;
}

.per-page-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination-item {
    display: inline-block;
}

.pagination-link {
    display: block;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    min-width: 40px;
    text-align: center;
}

.pagination-link:hover {
    background: #f0f0f0;
    border-color: #999;
}

.pagination-item.active .pagination-link {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
    pointer-events: none;
}

.pagination-item.disabled .pagination-link {
    color: #ccc;
    pointer-events: none;
    cursor: not-allowed;
}

.pagination-ellipsis .pagination-link {
    border: none;
    pointer-events: none;
}

/* Job detail page */
.breadcrumb-nav {
    padding: 15px 0;
    margin-bottom: 20px;
}

.breadcrumb {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0;
    font-size: 14px;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
    content: '›';
    margin-left: 8px;
    color: #999;
}

.breadcrumb-item a {
    color: #007bff;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #666;
}

.job-hero {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 40px 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.job-hero-title {
    font-size: 32px;
    font-weight: 700;
    color: #222;
    margin: 0 0 20px 0;
}

.job-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
}

.job-hero-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #555;
    font-size: 15px;
}

.meta-icon {
    flex-shrink: 0;
}

.job-hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.job-content-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
    margin-bottom: 40px;
}

@media (max-width: 1024px) {
    .job-content-grid {
        grid-template-columns: 1fr;
    }

    .job-sidebar {
        order: -1;
    }
}

.job-main-content {
    min-width: 0;
}

.content-block {
    margin-bottom: 35px;
}

.content-heading {
    font-size: 24px;
    font-weight: 600;
    color: #222;
    margin: 0 0 15px 0;
}

.content-text {
    line-height: 1.8;
    color: #444;
}

.content-text p {
    margin-bottom: 15px;
}

.content-text ul,
.content-text ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.content-text li {
    margin-bottom: 8px;
}

.content-text strong {
    font-weight: 600;
    color: #222;
}

.content-text h1, .content-text h2, .content-text h3 {
    margin-top: 25px;
    margin-bottom: 15px;
    color: #222;
}

/* Sidebar */
.job-sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
}

.sidebar-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
}

.sticky-card {
    position: sticky;
    top: 20px;
}

.sidebar-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #222;
    margin: 0 0 15px 0;
}

.sidebar-card-text {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.job-title-highlight {
    font-size: 20px;
    font-weight: 600;
    color: #222;
    margin: 0 0 10px 0;
}

.view-job-link {
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
}

.view-job-link:hover {
    text-decoration: underline;
}

.info-list {
    margin: 0;
}

.info-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

.info-item dt {
    font-weight: 500;
    color: #666;
    font-size: 14px;
}

.info-item dd {
    margin: 0;
    color: #333;
    font-size: 14px;
    text-align: right;
}

.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}

.share-btn:hover {
    background: #f0f0f0;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: #f0f0f0;
    color: #333;
    transition: background 0.2s;
}

.social-icon:hover {
    background: #007bff;
    color: #fff;
}

.footer-social {
    display: flex;
    gap: 10px;
}

.job-footer {
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* Application page */
.application-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

@media (max-width: 1024px) {
    .application-grid {
        grid-template-columns: 1fr;
    }

    .application-sidebar {
        order: -1;
    }
}

.application-form-column {
    max-width: 700px;
}

.application-title {
    font-size: 28px;
    font-weight: 700;
    color: #222;
    margin: 0 0 10px 0;
}

.application-subtitle {
    color: #666;
    font-size: 16px;
    margin-bottom: 30px;
}

.required-indicator {
    color: #dc3545;
}

.form-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 30px 0;
}

.form-legend {
    font-size: 20px;
    font-weight: 600;
    color: #222;
    margin-bottom: 20px;
    padding: 0;
}

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

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

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

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #666;
}

.file-upload-wrapper {
    position: relative;
}

.file-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.file-label:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.file-icon {
    flex-shrink: 0;
}

.file-name {
    color: #666;
    font-size: 14px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tips-list li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.tips-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
}

.contact-link:hover {
    text-decoration: underline;
}

/* Flash messages */
.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.flash {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.flash-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.flash-message {
    flex: 1;
    font-size: 14px;
}

.flash-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    color: inherit;
    opacity: 0.7;
}

.flash-close:hover {
    opacity: 1;
}

.flash-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.flash-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.flash-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.flash-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: background 0.2s, transform 0.2s;
    z-index: 999;
}

.back-to-top:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

/* DRY RUN banner (if in dev mode) */
.dry-run-banner {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #000;
    padding: 15px 20px;
    text-align: center;
    font-weight: bold;
    border-radius: 4px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.dry-run-banner strong {
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
}

.dry-run-banner p {
    margin: 0;
    font-size: 14px;
    font-weight: normal;
}

.dry-run-icon {
    font-size: 24px;
    margin-right: 10px;
}

.dry-run-content {
    display: inline-block;
    text-align: left;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .iframe-content {
        padding: 15px;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .job-card {
        padding: 20px;
    }

    .job-title {
        font-size: 18px;
    }

    .job-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .job-hero {
        padding: 30px 15px;
    }

    .job-hero-title {
        font-size: 24px;
    }

    .job-hero-actions {
        flex-direction: column;
    }

    .job-hero-actions .btn {
        width: 100%;
    }

    .content-heading {
        font-size: 20px;
    }

    .flash-messages {
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ====================
   Form Validation States
   ==================== */

/* Error state */
.form-input.field-error,
.form-textarea.field-error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.form-input.field-error:focus,
.form-textarea.field-error:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

/* Success state */
.form-input.field-success,
.form-textarea.field-success {
    border-color: #28a745;
    background-color: #f0fff4;
}

.form-input.field-success:focus,
.form-textarea.field-success:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.15);
}

/* Error message */
.field-error-message {
    display: flex;
    align-items: center;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.field-error-message::before {
    content: "⚠";
    margin-right: 0.25rem;
}

/* Warning message */
.field-warning-message {
    display: flex;
    align-items: center;
    color: #ff9800;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.field-warning-message::before {
    content: "ℹ";
    margin-right: 0.25rem;
}

/* Loading state for submit button */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   ACCESSIBILITY: Focus Indicators (WCAG 2.1 AA)
   ======================================== */

/* Remove default outline to use custom focus styles */
*:focus {
    outline: none;
}

/* Focus-visible polyfill for better keyboard navigation UX */
/* Shows focus only on keyboard navigation, not mouse clicks */

/* Buttons */
button:focus-visible,
.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.back-to-top:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
}

/* Links */
a:focus-visible,
.job-card a:focus-visible,
.pagination-link:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
    border-radius: 2px;
}

/* Form inputs */
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.form-control:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
    border-color: #2196F3;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
}

/* Radio buttons and checkboxes */
input[type="radio"]:focus-visible,
input[type="checkbox"]:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
}

/* File upload button */
input[type="file"]:focus-visible,
.file-upload-btn:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
}

/* Search input */
.search-box input:focus-visible,
#searchInput:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 0;
    border-color: #2196F3;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
}

/* Filter buttons */
.filter-btn:focus-visible,
.location-filter button:focus-visible,
.job-type-filter button:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
}

/* Pagination controls */
.pagination button:focus-visible,
.pagination a:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
}

/* Job cards - entire card focusable */
.job-card:focus-within {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
}

/* Flash message close button */
.flash-close:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
}

/* Back to top button */
#backToTop:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    *:focus-visible {
        outline-width: 4px;
        outline-color: currentColor;
    }
}

/* Reduced motion support for focus transitions */
@media (prefers-reduced-motion: reduce) {
    *:focus-visible {
        transition: none;
    }
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
    *:focus {
        outline: 3px solid #2196F3;
        outline-offset: 2px;
    }
}
