:root {
    --primary: #2563eb; /* Primary blue color */
    --secondary: #7c3aed; /* Secondary purple color */
    --accent: #f59e0b; /* Accent orange color */
    --dark: #1e293b; /* Dark slate color */
    --light: #f8fafc; /* Light gray color */
    --timeline-line: #dc0505; /* Red color for the timeline */
    --timeline-line-width: 2px; /* Width of the timeline */
}

body {
    font-family: 'Inter', sans-serif; /* Modern sans-serif font */
    color: var(--text-primary); /* Default text color based on theme */
    line-height: 1.6; /* Adjusted: Increased body line height for readability */
    margin: 0; /* Remove default body margin */
    padding: 0; /* Remove default body padding */
    min-height: 100vh; /* Ensure body takes at least full viewport height */
    transition: all 0.3s ease; /* Smooth transition for theme changes */
}

/* Light Mode Variables */
body.light-mode {
    --bg-primary: #ffffff; /* White background */
    --bg-secondary: #f8fafc; /* Light gray secondary background */
    --text-primary: #1e293b; /* Dark text */
    --text-secondary: #64748b; /* Lighter gray text */
    --card-bg: #ffffff; /* White card background */
    --card-border: #e2e8f0; /* Light gray card border */
    background-color: var(--bg-primary); /* Apply primary background color */
    /* Subtle radial gradients for background texture */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(248, 250, 252, 0.8) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(226, 232, 240, 0.8) 0%, transparent 20%);
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-primary: #0f172a; /* Very dark blue background */
    --bg-secondary: #1e293b; /* Dark slate secondary background */
    --text-primary: #e2e8f0; /* Light gray text */
    --text-secondary: #94a3b8; /* Medium gray text */
    --card-bg: rgba(30, 41, 59, 0.7); /* Semi-transparent dark card background */
    --card-border: rgba(255, 255, 255, 0.1); /* Faint white card border */
    background-color: var(--bg-primary); /* Apply primary background color */
    /* Subtle radial gradients using theme colors */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(124, 58, 237, 0.1) 0%, transparent 20%);
}

.container {
    max-width: 100%; /* Use full width */
    padding: 0; /* No padding on the main container */
    margin: 0; /* No margin on the main container */
}

.header {
    background: var(--bg-secondary); /* Use secondary background color */
    padding: 1rem 5%; /* Padding top/bottom and left/right */
    border-bottom: 1px solid var(--card-border); /* Subtle border */
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1); /* Soft shadow */
    backdrop-filter: blur(10px); /* Frosted glass effect (if background is transparent/semi-transparent) */
    position: relative; /* Needed for absolute positioning of children if any */
    display: flex; /* Use flexbox for layout */
    justify-content: space-between; /* Space out title and toggle */
    align-items: center; /* Vertically align items */
}

.main-heading {
    font-size: 1.8rem; /* Heading size for mobile */
    font-weight: 800; /* Bold font weight */
    margin: 0; /* Remove default margin */
    /* Gradient text effect */
    background: linear-gradient(90deg, #f59e0b, #f97316);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative; /* Needed for the 'LIVE' badge positioning */
}

/* 'LIVE' badge next to the main heading */
.main-heading::after {
    content: 'LIVE';
    position: absolute;
    top: -8px; /* Position above the text */
    right: -40px; /* Position to the right */
    background-color: #ef4444; /* Red background */
    color: white; /* White text */
    font-size: 0.7rem; /* Small font size */
    font-weight: 700; /* Bold */
    padding: 0.2rem 0.6rem; /* Padding around text */
    border-radius: 9999px; /* Pill shape */
    animation: pulse 1.5s infinite; /* Pulsing animation */
}

/* Theme Toggle Styles */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Space between icon and switch */
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px; /* Width of the switch */
    height: 24px; /* Height of the switch */
}

.toggle-switch input {
    opacity: 0; /* Hide the actual checkbox */
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc; /* Default background (off state) */
    transition: .4s; /* Smooth transition */
    border-radius: 24px; /* Rounded shape */
}

.slider:before {
    position: absolute;
    content: '';
    height: 16px; /* Height of the knob */
    width: 16px; /* Width of the knob */
    left: 4px; /* Initial position (off state) */
    bottom: 4px; /* Position from bottom */
    background-color: white; /* Knob color */
    transition: .4s; /* Smooth transition */
    border-radius: 50%; /* Circular knob */
}

/* Styles when the toggle is checked (on state) */
input:checked + .slider {
    background: linear-gradient(90deg, var(--primary), var(--secondary)); /* Gradient background */
}

input:checked + .slider:before {
    transform: translateX(26px); /* Move knob to the right */
}

/* Timeline Container (Mobile First) */
.timeline {
    position: relative; /* Establishes positioning context for pseudo-elements */
    max-width: 100%; /* Ensure full width */
    margin: 0 auto; /* Center the timeline */
    padding: 0.8rem 0; /* Increased padding top and bottom slightly for dot visibility */
}

/* Vertical Line - Centered on Mobile */
.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%; /* Center the line horizontally */
    transform: translateX(-50%); /* Fine-tune centering */
    width: var(--timeline-line-width); /* Use variable for width */
    background-color: var(--timeline-line); /* Use variable for color */
    height: 100%; /* Full height of the container */
    z-index: 1; /* Place the line behind dots and content */
}

/* Individual Timeline Item Container (Mobile First) */
.timeline-item {
    position: relative; /* Establishes positioning context for pseudo-elements and content */
    margin-bottom: 2rem; /* Increased space between items significantly */
    width: 98%; /* Increased width to be closer to full width */
    margin-left: auto; /* Center the item container */
    margin-right: auto; /* Center the item container */
    padding: 0 0.2rem; /* Reduced horizontal padding */
}

/* Outer Dot on the Vertical Line (Mobile First) */
.timeline-item::before {
    content: '';
    position: absolute;
    top: 20px; /* Vertical position to center with larger dot */
    left: 50%; /* Center horizontally on the parent item */
    width: 20px; /* Increased dot size */
    height: 20px; /* Increased dot size */
    border: 3px solid var(--timeline-line); /* Increased border thickness */
    border-radius: 50%; /* Make it circular */
    background-color: var(--bg-primary); /* Background matches page background */
    transform: translateX(-50%); /* Center the dot precisely on the line */
    z-index: 6; /* Increased z-index to be above the card */
}

/* Inner Dot (Mobile First) */
.timeline-item::after {
    content: '';
    position: absolute;
    top: 26px; /* Position to center with larger outer dot */
    left: 50%; /* Center horizontally */
    width: 8px; /* Increased inner dot size */
    height: 8px; /* Increased inner dot size */
    background-color: var(--timeline-line); /* Color matches line */
    border-radius: 50%; /* Make it circular */
    transform: translateX(-50%); /* Center the dot precisely */
    z-index: 6; /* Increased z-index to be above the card */
}

/* Timeline Item Content Card (Mobile First) */
.timeline-item-content {
    background: var(--card-bg); /* Use theme-based card background */
    backdrop-filter: blur(10px); /* Apply blur if background is semi-transparent */
    padding: 0.7rem; /* Slightly increased padding inside the card for mobile */
    border-radius: 12px; /* Rounded corners */
    border: 1px solid var(--card-border); /* Subtle border */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); /* Soft shadow */
    position: relative; /* Needed for z-index */
    overflow: hidden; /* Ensures content respects border radius */
    z-index: 5; /* Card z-index */
}

/* Timestamp (Mobile First) */
.timeline-time {
    font-size: 0.85rem; /* Increased font size */
    color: var(--text-secondary); /* Use secondary text color */
    margin-bottom: 0.3rem; /* Increased space below the time */
    display: block; /* Ensure it takes its own line */
    font-weight: 500; /* Medium weight */
}

/* Headline (Mobile First) */
.timeline-headline {
    font-size: 1.2rem; /* Increased headline font size */
    font-weight: 700; /* Bold */
    margin-bottom: 0.7rem; /* Increased space below headline */
    line-height: 1.4; /* Increased line height for headlines */
    color: var(--text-primary); /* Use primary text color */
}

/* Snippet/Body Text (Mobile First) */
.timeline-snippet {
    font-size: 0.95rem; /* Increased font size */
    color: var(--text-secondary); /* Use secondary text color */
    line-height: 1.6; /* Standardized line height */
    text-align: left; /* Align text to the left */
}

/* Image Styling (Mobile First) */
.timeline-image {
    width: 100%; /* Full width of the card */
    height: auto; /* Maintain aspect ratio */
    max-height: 200px; /* Reduced max height */
    border-radius: 8px; /* Rounded corners */
    margin-bottom: 0.5rem; /* Reduced space below image */
    object-fit: cover; /* Cover the area, cropping if needed */
    border: 1px solid var(--card-border); /* Subtle border */
}

/* Video Container (for responsive aspect ratio) (Mobile First) */
.timeline-video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin-bottom: 0.5rem; /* Reduced space below video */
    border-radius: 8px; /* Rounded corners */
}

/* Embedded Video (iframe) (Mobile First) */
.timeline-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none; /* Remove default iframe border */
}

/* Category Badges Base Style (Mobile First) */
.category-badge {
    display: inline-block; /* Allow multiple badges on one line */
    color: white; /* Text color */
    font-size: 0.65rem; /* Increased font size */
    font-weight: 700; /* Bold */
    padding: 0.1rem 0.4rem; /* Slightly increased padding */
    border-radius: 5px; /* Slightly rounded corners */
    text-transform: uppercase; /* Uppercase text */
    letter-spacing: 0.4px; /* Reduced letter spacing */
    margin-right: 0.3rem; /* Reduced space between badges */
    margin-bottom: 0.3rem; /* Reduced space below badges if they wrap */
}

/* Specific Badge Colors & Effects */
.badge-breaking {
    background: linear-gradient(90deg, #ef4444, #dc2626); /* Red gradient */
    animation: pulse 1.5s infinite; /* Add pulse animation */
}

.badge-politics { background: linear-gradient(90deg, #3b82f6, #2563eb); } /* Blue gradient */
.badge-technology { background: linear-gradient(90deg, #8b5cf6, #7c3aed); } /* Purple gradient */
.badge-business { background: linear-gradient(90deg, #10b981, #059669); } /* Green gradient */
.badge-health { background: linear-gradient(90deg, #ec4899, #db2777); } /* Pink gradient */
.badge-sports { background: linear-gradient(90deg, #f59e0b, #d97706); } /* Orange gradient */
.badge-entertainment { background: linear-gradient(90deg, #6366f1, #4f46e5); /* Indigo gradient */
}
.badge-defense { background: linear-gradient(90deg, #6b7280, #4b5563); /* Gray gradient */
}
.badge-space { background: linear-gradient(90deg, #14b8a6, #0d9488); /* Teal gradient */
}

/* Keyframe Animations */
@keyframes pulse {
    0% { opacity: 0.6; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.6; transform: scale(0.95); }
}

/* Tablet and Desktop Styles */
@media (min-width: 768px) {
    .header {
        padding: 1.5rem 5%; /* Increase header padding */
    }

    .main-heading {
        font-size: 2.5rem; /* Increase heading size */
    }

    .main-heading::after {
        top: -10px; /* Adjust badge position */
        right: -50px; /* Adjust badge position */
        font-size: 0.8rem; /* Slightly larger badge */
        padding: 0.2rem 0.8rem; /* Adjust badge padding */
    }

    /* Timeline Container (Desktop Flexbox Layout) */
    .timeline {
        position: relative; /* Establishes positioning context for pseudo-elements */
        max-width: 1200px; /* Limit max width on very large screens */
        margin: 0 auto; /* Center the timeline */
        padding: 2rem 0; /* Added padding top and bottom for desktop */
    }

    /* Vertical Line - Centered on Desktop */
    .timeline::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0; /* Ensure line spans full height */
        left: 50%; /* Center the line horizontally */
        transform: translateX(-50%); /* Fine-tune centering */
        width: var(--timeline-line-width); /* Use variable for width */
        background-color: var(--timeline-line); /* Use variable for color */
        z-index: 1; /* Place the line behind dots and content */
        height: 100%; /* Ensure line spans full height */
    }

    /* Individual Timeline Item Container (Desktop Flexbox Positioning) */
    .timeline-item {
        position: relative; /* Needed for dot positioning */
        margin-bottom: 3rem; /* Increased space between items significantly */
        width: 90%; /* Set a width for items on desktop */
        max-width: 1200px; /* Limit max width */
        margin-left: auto; /* Center the item container */
        margin-right: auto; /* Center the item container */
        padding: 0; /* Remove padding */
        display: flex; /* Use flexbox for layout */
        align-items: center; /* Vertically align items */
        justify-content: space-between; /* Space out content and dot area */
    }

    /* Outer Dot on the Vertical Line (Desktop Positioning) */
    .timeline-item::before {
        content: '';
        position: absolute;
        top: 50%; /* Vertically center within the item */
        width: 20px; /* Increased dot size */
        height: 20px; /* Increased dot size */
        border: 3px solid var(--timeline-line); /* Increased border thickness */
        border-radius: 50%; /* Make it circular */
        background-color: var(--bg-primary); /* Background matches page background */
        z-index: 6; /* Increased z-index to be above the card */
        transform: translate(-50%, -50%); /* Center the dot */
    }

    /* Inner Dot (Desktop Positioning) */
    .timeline-item::after {
        content: '';
        position: absolute;
        top: 50%; /* Vertically center within the item */
        width: 8px; /* Increased inner dot size */
        height: 8px; /* Increased inner dot size */
        background-color: var(--timeline-line); /* Color matches line */
        border-radius: 50%; /* Make it circular */
        z-index: 6; /* Increased z-index to be above the card */
        transform: translate(-50%, -50%); /* Center the dot */
    }

    /* Timeline Item Content Card (Desktop Positioning) */
    .timeline-item-content {
        background: var(--card-bg); /* Use theme-based card background */
        backdrop-filter: blur(10px); /* Apply blur if background is semi-transparent */
        padding: 2rem; /* Restore padding */
        border-radius: 12px; /* Rounded corners */
        border: 1px solid var(--card-border); /* Subtle border */
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); /* Soft shadow */
        position: relative; /* Needed for z-index */
        overflow: hidden; /* Ensures content respects border radius */
        z-index: 5; /* Card z-index */
        width: 48%; /* Set width for content card */
    }

    /* Alternate content alignment for left/right sides of the timeline */
    .timeline-item:nth-child(odd) .timeline-item-content {
        margin-right: 2%; /* Space between card and line */
    }

    .timeline-item:nth-child(even) .timeline-item-content {
        margin-left: 2%; /* Space between card and line */
        order: 2; /* Place even items on the right */
    }

    /* Position dots relative to the timeline item based on left/right placement */
     .timeline-item:nth-child(odd)::before,
     .timeline-item:nth-child(odd)::after {
         left: 100%; /* Position at the right edge of the odd item */
         transform: translate(-50%, -50%); /* Shift left by half the dot's width */
     }

     .timeline-item:nth-child(even)::before,
     .timeline-item:nth-child(even)::after {
         left: 0%; /* Position at the left edge of the even item */
         transform: translate(-50%, -50%); /* Shift left by half the dot's width */
     }


    .timeline-time {
        font-size: 1rem; /* Adjusted: Increased font size for desktop */
        margin-bottom: 0.6rem; /* Adjusted: Increased space below time */
    }

    .timeline-headline {
        font-size: 1.6rem; /* Adjusted: Increased font size for desktop */
        margin-bottom: 1.2rem; /* Adjusted: Increased space below headline */
        line-height: 1.4; /* Restore line height */
    }

    .timeline-snippet {
        font-size: 1.05rem; /* Adjusted: Increased font size for desktop */
        line-height: 1.6; /* Adjusted: Standardized line height for desktop */
    }

    .timeline-image {
        max-height: 300px; /* Restore image height */
        margin-bottom: 1rem; /* Restore space below image */
    }

    .timeline-video-container {
        margin-bottom: 1rem; /* Restore space below video */
    }

    .category-badge {
        position: absolute;
        top: 1rem;
        right: 1rem;
        margin: 0; /* Remove bottom/right margins */
        font-size: 0.75rem; /* Adjusted: Increased font size for desktop */
        padding: 0.15rem 0.6rem; /* Restore padding */
        letter-spacing: 1px; /* Restore letter spacing */
    }
}

/* Styles for Very Small Mobile Devices */
@media (max-width: 400px) {
    .header {
        flex-direction: column; /* Stack header items vertically */
        align-items: flex-start; /* Align items to the start */
        gap: 1rem; /* Add gap between stacked items */
    }

    /* Adjust 'LIVE' badge position for stacked header */
    .main-heading::after {
        position: static; /* Remove absolute positioning */
        display: inline-block; /* Display next to text */
        margin-left: 0.5rem; /* Add space to the left */
        vertical-align: middle; /* Align vertically */
    }

    /* Slightly reduce card padding on very small screens */
    .timeline-item-content {
        padding: 0.5rem; /* Further reduced padding */
    }

    .timeline-time {
      font-size: 0.8rem; /* Adjusted: Increased font size */
      margin-bottom: 0.3rem; /* Adjusted: Increased margin */
    }

    .timeline-headline {
      font-size: 1.1rem; /* Adjusted: Increased font size */
      margin-bottom: 0.5rem; /* Adjusted: Increased margin */
      line-height: 1.3; /* Adjusted: Increased line height */
    }

    .timeline-snippet {
      font-size: 0.9rem; /* Adjusted: Increased font size */
      line-height: 1.5; /* Adjusted: Increased line height */
    }

    .timeline-image {
       max-height: 180px; /* Reduced max height */
       margin-bottom: 0.5rem; /* Adjusted: Increased margin */
    }

    .timeline-video-container {
       margin-bottom: 0.5rem; /* Adjusted: Increased margin */
    }

    .category-badge {
      font-size: 0.6rem; /* Adjusted: Increased font size */
      padding: 0.08rem 0.35rem; /* Adjusted: Slightly increased padding */
      margin-right: 0.25rem; /* Adjusted: Slightly increased margin */
      margin-bottom: 0.25rem; /* Adjusted: Slightly increased margin */
    }
}
