/**
 * WP Jobs Plugin - Frontend Styles
 * Version: 1.0.1 - Simplify dark mode selectors, remove !important overuse
 */

/* ============================================
   CONTAINER & GRID LAYOUT
   ============================================ */

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

.srjobs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
    .srjobs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 columns */
@media (min-width: 1024px) {
    .srjobs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   JOB CARD STYLES
   ============================================ */

.srjobs-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.srjobs-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: #cbd5e0;
}

/* ============================================
   CARD HEADER
   ============================================ */

.srjobs-card-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid #f7fafc;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.srjobs-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
}

.srjobs-title a {
    color: #2d3748;
    text-decoration: none;
    transition: color 0.2s ease;
}

.srjobs-title a:hover {
    color: #ff6b00;
}

/* Job Type Badge */
.srjobs-type {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.srjobs-type-full-time {
    background: #c6f6d5;
    color: #22543d;
}

.srjobs-type-part-time {
    background: #bee3f8;
    color: #2c5282;
}

.srjobs-type-contract {
    background: #feebc8;
    color: #7c2d12;
}

.srjobs-type-temporary {
    background: #fef5e7;
    color: #975a16;
}

.srjobs-type-internship {
    background: #e9d8fd;
    color: #44337a;
}

.srjobs-type-freelance {
    background: #fed7d7;
    color: #742a2a;
}

/* ============================================
   CARD BODY
   ============================================ */

.srjobs-card-body {
    padding: 16px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Employer Info */
.srjobs-employer {
    display: flex;
    align-items: center;
    gap: 12px;
}

.srjobs-employer-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: #f7fafc;
    padding: 4px;
}

.srjobs-employer-name {
    font-size: 15px;
    font-weight: 500;
    color: #4a5568;
}

/* Location & Posted Date */
.srjobs-location,
.srjobs-posted {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #718096;
}

.srjobs-icon {
    flex-shrink: 0;
    opacity: 0.6;
}

/* ============================================
   CARD FOOTER
   ============================================ */

.srjobs-card-footer {
    padding: 16px 20px 20px;
    border-top: 1px solid #f7fafc;
}

.srjobs-btn-primary {
    display: block;
    width: 100%;
    padding: 12px 24px;
    background: #ff6b00;
    color: #ffffff;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 2px solid #ff6b00;
}

.srjobs-btn-primary:hover {
    background: #e55d00;
    border-color: #e55d00;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
    color: #ffffff;
}

.srjobs-btn-primary:active {
    transform: translateY(0);
}

/* ============================================
   NO RESULTS STATE
   ============================================ */

.srjobs-no-results {
    text-align: center;
    padding: 60px 20px;
    background: #f7fafc;
    border-radius: 12px;
    color: #718096;
}

.srjobs-no-results-icon {
    margin-bottom: 20px;
    opacity: 0.4;
}

.srjobs-no-results h3 {
    margin: 0 0 12px;
    font-size: 24px;
    font-weight: 600;
    color: #2d3748;
}

.srjobs-no-results p {
    margin: 0;
    font-size: 16px;
    color: #718096;
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 767px) {
    .srjobs-container {
        padding: 16px;
    }
    
    .srjobs-grid {
        gap: 16px;
    }
    
    .srjobs-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .srjobs-type {
        align-self: flex-start;
    }
    
    .srjobs-title {
        font-size: 16px;
    }
    
    .srjobs-btn-primary {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.srjobs-card:focus-within {
    outline: 2px solid #ff6b00;
    outline-offset: 2px;
}

.srjobs-btn-primary:focus {
    outline: 2px solid #ff6b00;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .srjobs-card {
        border-width: 2px;
    }
    
    .srjobs-btn-primary {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .srjobs-card,
    .srjobs-btn-primary,
    .srjobs-title a {
        transition: none;
    }
    
    .srjobs-card:hover {
        transform: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .srjobs-grid {
        grid-template-columns: 1fr;
    }
    
    .srjobs-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .srjobs-btn-primary {
        display: none;
    }
}

/* ============================================
   BROKEN IMAGE HANDLING (CSP Compliant)
   ============================================ */

/* Replaces inline onerror JavaScript handler */
.srjobs-employer-logo {
    display: inline-block;
    max-height: 40px;
    max-width: 120px;
    object-fit: contain;
}

/* Hide image if src is empty or invalid */
.srjobs-employer-logo:not([src]),
.srjobs-employer-logo[src=""],
.srjobs-employer-logo[src="#"] {
    display: none;
}

/* When image fails to load, don't show broken icon */
.srjobs-employer-logo::before {
    content: '';
    display: none;
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

/* Dark mode: Job cards */
.dark-theme .srjobs-card {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.15);
}

.dark-theme .srjobs-card:hover {
    background: #212121;
    border-color: rgba(255, 255, 255, 0.25);
}

/* Dark mode: Card header */
.dark-theme .srjobs-card-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Dark mode: Title links */
.dark-theme .srjobs-title a {
    color: #ffffff;
}

/* Dark mode: Text colors */
.dark-theme .srjobs-employer-name,
.dark-theme .srjobs-location span,
.dark-theme .srjobs-posted span,
.dark-theme .srjobs-description {
    color: rgba(255, 255, 255, 0.85);
}

/* Dark mode: Icons */
.dark-theme .srjobs-icon {
    color: rgba(255, 255, 255, 0.6);
}

/* Dark mode: Card footer */
.dark-theme .srjobs-card-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}
