/* =======================================================
   AI AUTO JOB ENGINE - CLASSIC PROFESSIONAL LAYOUT
   (Final Polish: Permanent Blue Accent on Related Cards)
   (Updated: Mobile Responsive + AdSense Fix + Sidebar Redesign)
   ======================================================= */

/* --- General Theme Overrides --- */
.entry-meta, .post-meta, .byline, .posted-on { display: none !important; }

/* --- GLOBAL RESET FOR PLUGIN (Fixes Scroll Issues) --- */
/* This ensures padding is calculated INSIDE the width. */
.aaje-job-listing, 
.aaje-job-listing *, 
.aaje-job-listing *::before, 
.aaje-job-listing *::after {
    box-sizing: border-box;
}

/* --- Main Job Listing Layout --- */
.aaje-job-listing {
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 2rem auto;
    max-width: 1100px;
    width: 100%; /* Ensure it fits smaller screens */
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    color: #333;
    padding: 0 15px; /* Added safe side padding for mobile */
    overflow-x: clip; /* Modern fix: stops scrollbar without cutting content inside */
}

/* --- 1. ADSENSE SAFE ZONE --- */
/* Main content has NO border/box so Ads can flow naturally */
.aaje-main-content {
    flex: 1;
    min-width: 0; /* Critical: Allows flex container to shrink below content size */
    max-width: 100%; /* Forces container to never exceed screen width */
    padding: 0;
    margin: 0;
}

/* --- SPECIFIC FIX FOR GOOGLE ADSENSE --- */
/* Forces Ads (ins/iframe) to respect the screen width and resize down */
.aaje-main-content ins,
.aaje-main-content iframe,
.aaje-main-content img,
.aaje-main-content video {
    max-width: 100% !important; /* Force width to fit container */
    width: auto; /* Allow aspect ratio to maintain */
    box-sizing: border-box !important;
}

/* Ensure iframes (common in Ads) don't force width */
.aaje-main-content iframe {
    width: 100% !important;
}

/* --- 2. THE CLASSIC CARD HEADER --- */
/* Simple, White, Professional */
.aaje-job-header {
    background-color: #ffffff; /* Clean White */
    border: 1px solid #e5e7eb; /* Very subtle border */
    border-top: 4px solid #2563eb; /* Top Blue Accent (Professional Touch) */
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04); /* Almost invisible shadow */
    border-radius: 4px;
    word-wrap: break-word; /* Prevents long titles from stretching width */
    overflow-wrap: break-word;
}

/* Job Title */
.aaje-job-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    margin-top: 0;
    margin-bottom: 1rem;
    line-height: 1.2;
}

/* Meta Container (The Pills) */
.aaje-job-meta {
    display: flex;
    flex-wrap: wrap; /* Ensures responsiveness on mobile */
    gap: 10px;
    align-items: center;
}

/* Individual Meta Pills (Long Text Fixed) */
.aaje-meta-item {
    display: inline-flex;
    align-items: center;
    background-color: #f9fafb; /* Very light gray */
    color: #4b5563;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 4px; /* Classic slight curve */
    
    /* FIX FOR LONG TEXT: */
    white-space: normal; 
    word-break: break-word; 
    max-width: 100%; 
    text-decoration: none !important;
}

/* --- 3. THE CONTENT STYLE --- */

.aaje-job-content {
    font-size: 1rem;
    line-height: 1.7;
    color: #374151;
    word-wrap: break-word; /* Prevents long text from scrolling */
    overflow-wrap: break-word;
}

/* SECTION HEADERS (About, Requirements, etc.) */
/* Gray Background Strip + Orange/Gold Left Bar */
.aaje-job-content h3 {
    background-color: #f3f4f6; 
    border-left: 5px solid #f59e0b; 
    padding: 10px 15px;        
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin-top: 2.5rem;        
    margin-bottom: 1.25rem;    
    border-radius: 0 4px 4px 0;
}

/* List Styling */
.aaje-job-content ul {
    margin-bottom: 1.5rem;
    padding-left: 20px;
}

.aaje-job-content li {
    margin-bottom: 0.75rem; 
}

/* --- Apply Button --- */
.aaje-apply-button-wrapper {
    margin-top: 3rem;
}
.aaje-apply-button {
    display: inline-block;
    background-color: #2563eb;
    color: #fff !important;
    padding: 1rem 3rem;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    text-align: center;
    max-width: 100%; /* Ensures button never overflows */
}
.aaje-apply-button:hover {
    background-color: #1d4ed8;
}

/* --- Sidebar Styling (Updated with Professional Design) --- */
.aaje-sidebar {
    width: 320px;
    flex-shrink: 0;
    max-width: 100%; /* Prevents sidebar from overflowing on resize */
}

/* Generic Widget Container */
.aaje-sidebar .widget {
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 4px;
    word-wrap: break-word; /* Safety for sidebar content */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Soft shadow */
}

.aaje-sidebar .widget-title,
.aaje-sidebar .aaje-recent-jobs-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f3f4f6;
    color: #111827;
    margin-top: 0;
}

/* --- NEW: Professional Recent Jobs Widget Styling --- */

/* Reset List Styles */
.aaje-sidebar .aaje-recent-jobs-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* The Job Item Row */
.aaje-sidebar .aaje-recent-job-item {
    margin: 0;
    padding: 0;
}

/* The Clickable Link Area */
.aaje-sidebar .aaje-recent-job-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
    padding: 10px;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
}

/* Hover Effect */
.aaje-sidebar .aaje-recent-job-item a:hover {
    background-color: #f9fafb; /* Light gray bg */
    border-color: #e5e7eb;     /* Subtle border appearance */
    transform: translateX(2px); /* Slight movement */
}

/* The Logo Circle (Fixes the Purple Block) */
.aaje-sidebar .aaje-recent-job-logo {
    width: 42px;
    height: 42px;
    border-radius: 50%; /* Perfect circle */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff; /* Text color inside logo */
    flex-shrink: 0; /* Prevents squashing */
    text-transform: uppercase;
}

/* Text Details Container */
.aaje-sidebar .aaje-recent-job-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Job Title Text */
.aaje-sidebar .aaje-recent-job-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 3px;
    line-height: 1.3;
    white-space: normal; /* Allow wrap */
    word-break: break-word;
    transition: color 0.2s;
}

/* Meta Text (Company - Location) */
.aaje-sidebar .aaje-recent-job-meta {
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
}

/* Hover: Turn Title Blue */
.aaje-sidebar .aaje-recent-job-item a:hover .aaje-recent-job-title {
    color: #2563eb;
}

/* --- Related Jobs (Professional Cards) --- */
.aaje-related-jobs-container {
    margin-top: 4rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 2.5rem;
    max-width: 100%; /* Containment fix */
    overflow: hidden; /* Prevent grid blow-out */
}

.aaje-related-jobs-container h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1.5rem;
}

/* Grid Layout */
.aaje-related-jobs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%; /* Force grid to fit container */
}

/* Tablet/Desktop: 2 Columns */
@media (min-width: 640px) {
    .aaje-related-jobs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* The Card Design */
.aaje-related-job-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 4px; /* Matches main header */
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    text-decoration: none !important;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
    
    /* PERMANENT BLUE TOP LINE (Matches Main Header) */
    border-top: 4px solid #2563eb; 
}

/* Hover Effects (Lift only) */
.aaje-related-job-card:hover {
    transform: translateY(-4px); /* Lift up */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05); /* Soft shadow */
    border-color: #d1d5db; 
    /* The border-top color stays blue */
}

/* Card Title */
.aaje-related-job-card h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
    transition: color 0.2s;
    word-break: break-word; /* Prevent title overflow */
}

.aaje-related-job-card:hover h4 {
    color: #2563eb;
}

/* Card Meta Data (Company & Location) */
.aaje-related-meta {
    margin-top: auto; /* Pushes to bottom */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #6b7280;
}

.aaje-related-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
    /* LONG TEXT FIX FOR RELATED CARDS */
    white-space: normal; 
    word-break: break-word;
}

/* =======================================================
   SMART MOBILE RESPONSIVENESS (Responsive Logic)
   ======================================================= */

/* 1. Standard Mobile & Tablet (Screen 900px and below) */
@media (max-width: 900px) {
    .aaje-job-listing {
        flex-direction: column; /* Stack sidebar below content */
        margin: 1.5rem auto;    /* Reduce margin */
        gap: 2rem;
        width: 100%;            /* Force full width */
        padding: 0 15px;        /* Safe padding on edges */
    }
    .aaje-sidebar {
        width: 100%;
    }
    .aaje-job-header h1 {
        font-size: 1.75rem;
    }
    
    /* Ensure no negative margins or overflow in the main content area */
    .aaje-main-content {
        width: 100%;
    }
}

/* 2. Tiny Screen Detection (iPhone SE/4 - under 480px) */
/* "Smart" Logic: Reduces padding to prevent squashed content */
@media (max-width: 480px) {
    .aaje-job-listing {
        margin: 1rem auto;
        padding: 0 10px; /* Tighter padding for small screens */
        gap: 1.5rem;
    }

    /* Reduce internal padding of cards to create more space for text */
    .aaje-job-header, 
    .aaje-sidebar .widget,
    .aaje-related-job-card {
        padding: 1rem; /* Reduced from 2rem to 1rem */
    }

    /* Font Adjustments */
    .aaje-job-header h1 {
        font-size: 1.5rem;
        word-break: break-word; /* Ensure long words break */
    }

    .aaje-job-content h3 {
        padding: 8px 10px;
        font-size: 1.1rem;
    }

    /* Apply Button: Make it full width for easier tapping */
    .aaje-apply-button {
        display: block;
        width: 100%;
        padding: 12px 0;
    }
    
    /* Meta Pills: Tighter spacing */
    .aaje-job-meta {
        gap: 6px;
    }
    .aaje-meta-item {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
}