/* Google Fonts: Outfit for Headings, Inter for Body */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* --- DESIGN SYSTEM & CSS VARIABLES --- */
:root {
    /* Fonts */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-quick: all 0.15s ease-in-out;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --shadow-glow: 0 0 15px rgba(6, 182, 212, 0.2);

    /* --- LIGHT THEME (Default) --- */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.75);
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --brand-primary: #0891b2; /* Cyan */
    --brand-secondary: #7c3aed; /* Violet */
    --brand-glow: rgba(8, 145, 178, 0.15);
    --bg-highlight: #ecfeff;
    --text-highlight: #0369a1;
}

[data-theme="dark"] {
    /* --- DARK THEME --- */
    --bg-main: #0b0f19;
    --bg-card: #161b26;
    --bg-glass: rgba(22, 27, 38, 0.8);
    --border-color: #1f2937;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --brand-primary: #06b6d4; /* Neon Cyan */
    --brand-secondary: #8b5cf6; /* Neon Violet */
    --brand-glow: rgba(6, 182, 212, 0.25);
    --bg-highlight: #083344;
    --text-highlight: #38bdf8;
}

/* --- BASE STYLES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: var(--transition-quick);
}

a:hover {
    color: var(--brand-secondary);
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button, input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
}

/* --- LAYOUT CONTAINER --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* --- HEADER & NAVIGATION --- */
header.site-header {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px border var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo a {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-dot {
    width: 8px;
    height: 8px;
    background-color: var(--brand-primary);
    border-radius: 50%;
    display: inline-block;
    box-shadow: var(--shadow-glow);
}

.site-nav ul {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.site-nav a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--text-primary);
    background-color: var(--border-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.theme-toggle-btn:hover {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    transform: rotate(15deg);
}

.sun-icon { display: none; }
.moon-icon { display: block; }
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

/* User Controls */
.user-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.avatar-nav {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--brand-primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #ffffff !important;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.3);
}

.btn-secondary {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
}

/* --- COMMON PAGE LAYOUT --- */
.page-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

@media (min-width: 992px) {
    .page-layout {
        grid-template-columns: 8fr 4fr;
    }
}

/* --- CARDS & PANELS --- */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--brand-primary);
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.card-title a {
    color: var(--text-primary);
}

.card-title a:hover {
    color: var(--brand-primary);
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.825rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background-color: var(--bg-highlight);
    color: var(--text-highlight);
}

/* --- HOMEPAGE SPECIFICS --- */
.hero-section {
    margin-bottom: 3rem;
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.1), rgba(124, 58, 237, 0.1));
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.hero-section h1 {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 1rem;
}

.hero-section p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 1.5rem auto;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

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

@media (min-width: 992px) {
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- NEWS ARTICLES SPECIFICS --- */
.article-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    background-color: var(--border-color);
}

.article-body-wrapper {
    margin-top: 1.5rem;
}

.article-body-wrapper p {
    margin-bottom: 1.2rem;
}

.article-header {
    margin-bottom: 2rem;
}

.article-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.author-info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

/* --- FORUM SPECIFICS --- */
.forum-category-row {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 0;
}

.forum-category-row:last-child {
    border-bottom: none;
}

.thread-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    transition: var(--transition-quick);
}

.thread-row:hover {
    border-color: var(--brand-primary);
    background-color: var(--bg-highlight);
}

.thread-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.thread-stats {
    display: flex;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: right;
}

/* Threaded replies and posts */
.forum-post {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    position: relative;
}

.forum-post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.post-vote-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vote-btn {
    border: 1px solid var(--border-color);
    background: none;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: 0.825rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition-quick);
}

.vote-btn:hover {
    background-color: var(--brand-glow);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.vote-btn.voted {
    background-color: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
}

/* Threaded replies styling */
.forum-replies-section {
    margin-left: 2.5rem;
    border-left: 2px solid var(--border-color);
    padding-left: 1.5rem;
}

/* --- JOB BOARD SPECIFICS --- */
.job-card {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.job-logo {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--border-color);
}

.job-logo-placeholder {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    border-radius: var(--radius-md);
}

.job-info {
    flex: 1;
}

.job-tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* --- NEWSLETTER WIDGET --- */
.newsletter-widget {
    background: linear-gradient(135deg, var(--bg-card), rgba(8, 145, 178, 0.05));
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* --- FORMS & INPUTS --- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: var(--transition-quick);
}

.form-control:focus {
    border-color: var(--brand-primary);
    background-color: var(--bg-card);
    box-shadow: var(--shadow-glow);
}

textarea.form-control {
    resize: vertical;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.error-text {
    font-size: 0.825rem;
    color: #ef4444;
    margin-top: 0.25rem;
}

.django-form p {
    margin-bottom: 1.25rem;
}
.django-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}
.django-form input,
.django-form textarea,
.django-form select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: var(--transition-quick);
}
.django-form input:focus,
.django-form textarea:focus,
.django-form select:focus {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-glow);
}

/* --- SIDEBAR WIDGETS --- */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-widget {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.widget-title {
    font-size: 1.125rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.widget-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.widget-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* --- PROFILE PAGE SPECIFICS --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--brand-primary);
}

.profile-avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #ffffff;
    font-size: 3rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-meta-row {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

/* --- MESSAGES & FLOATING NOTIFICATIONS --- */
.messages-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
}

.alert-message {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    color: #ffffff;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    animation: slideIn 0.3s ease-out forwards;
}

.alert-success { background-color: #10b981; }
.alert-error { background-color: #ef4444; }
.alert-info { background-color: #3b82f6; }
.alert-warning { background-color: #f59e0b; }

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

/* --- FOOTER --- */
footer.site-footer {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    margin-top: 4rem;
    color: var(--text-secondary);
}

.footer-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .footer-container {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

.footer-logo {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.footer-text {
    font-size: 0.875rem;
}

.footer-links h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: var(--brand-primary);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 2rem;
    text-align: center;
    font-size: 0.825rem;
    color: var(--text-muted);
}

/* --- UTILITIES --- */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}
.pagination-link {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
}
.pagination-link.active {
    background-color: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
}

/* --- 3D FUTURISTIC CYBERPUNK STYLING --- */

/* Tech grid background on body */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(var(--border-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.15;
    z-index: -2;
    pointer-events: none;
    transition: var(--transition-smooth);
}

[data-theme="dark"] body::before {
    opacity: 0.08;
    background-image: 
        linear-gradient(rgba(6, 182, 212, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(6, 182, 212, 0.1) 1px, transparent 1px);
}

/* 3D tilt container & card setups */
.tilt-container {
    perspective: 1000px;
}

.tilt-card {
    transition: transform 0.1s ease-out, box-shadow 0.3s ease, border-color 0.3s ease;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

/* Parallax depth: push card contents forward in 3D space */
.tilt-card > * {
    transform: translateZ(30px);
}

.tilt-card .article-thumbnail, 
.tilt-card .job-logo,
.tilt-card .job-logo-placeholder {
    transform: translateZ(50px);
    box-shadow: var(--shadow-lg);
}

/* Glowing volumetric shadows on hover */
[data-theme="dark"] .tilt-card:hover {
    box-shadow: 0 15px 35px rgba(6, 182, 212, 0.15), 0 0 15px rgba(139, 92, 246, 0.2);
    border-color: var(--brand-secondary);
}

/* 3D Receding Digital Grid Floor in Hero Section */
.hero-section {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.hero-grid-floor {
    position: absolute;
    bottom: -120px;
    left: 50%;
    width: 200%;
    height: 300px;
    background-image: 
        linear-gradient(var(--brand-primary) 1px, transparent 1px),
        linear-gradient(90deg, var(--brand-primary) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.12;
    transform: translateX(-50%) rotateX(80deg) translateZ(0);
    transform-origin: bottom center;
    pointer-events: none;
    z-index: -1;
    mask-image: linear-gradient(to top, rgba(0,0,0,1), rgba(0,0,0,0));
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1), rgba(0,0,0,0));
}

[data-theme="dark"] .hero-grid-floor {
    background-image: 
        linear-gradient(var(--brand-primary) 1px, transparent 1px),
        linear-gradient(90deg, var(--brand-primary) 1px, transparent 1px);
    opacity: 0.18;
}

