/* --- START OF style.css --- */

/* --- NEW: Force overflow hidden early --- */
html {
    overflow-x: hidden;
    scroll-behavior: smooth; /* Ensure smooth scrolling is set here */
}
:root {
    --primary-color: #007bff; /* Vibrant Blue */
    --secondary-color: #28a745; /* Green */
    --tertiary-color: #6f42c1; /* Purple */
    --accent-color: #fd7e14; /* Orange */
    --dark-color: #212529;  /* This is dark gray, will be text on light bg, or bg on dark bg */
    --light-color: #f8f9fa; /* This is light gray, will be bg on light theme, or text on dark theme */
    
    --text-color-light-theme: #343a40; /* Main text on light background */
    --bg-color-light-theme: #ffffff;   /* Main background on light theme */
    
    --text-color-dark-theme: #e2e8f0;  /* Main text on dark background */
    --bg-color-dark-theme: #1a202c;    /* Main background on dark theme */

    --text-on-dark-elements: #f8f9fa; /* Text for elements with dark backgrounds in light mode (e.g. dark navbar) */
    --text-on-light-elements: #212529; /* Text for elements with light backgrounds in dark mode (e.g. light cards) */

    --border-radius: 15px;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --transition-speed: 0.3s;
    --rgb-primary: 0, 123, 255;
}

body.dark-mode {
    --primary-color: #3a9eff;    /* Lighter blue for dark mode */
    --secondary-color: #34d399;  /* Lighter green */
    --tertiary-color: #a78bfa;   /* Lighter purple */
    --accent-color: #fb923c;     /* Lighter orange */
    
    /* Swapping dark and light for main bg/text */
    --dark-color: #f8f9fa;        /* Becomes the main text color on dark backgrounds */
    --light-color: #2d3748;       /* Becomes a common bg color for cards/sections */

    --text-color-dark-theme: #e2e8f0;
    --bg-color-dark-theme: #1a202c;

    --text-on-dark-elements: #f8f9fa; 
    --text-on-light-elements: #e2e8f0; /* Text on light cards in dark mode should also be light */


    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --rgb-primary: 58, 158, 255;
}

/* Base Styles & Scrollbar */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color-light-theme); /* Default to light theme */
    color: var(--text-color-light-theme); /* Default to light theme */
    overflow-x: hidden;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    scroll-behavior: smooth;
    font-size: 16px;
}
body.dark-mode {
    background-color: var(--bg-color-dark-theme);
    color: var(--text-color-dark-theme);
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--light-color); } /* In dark mode, this will be a dark track */
body.dark-mode ::-webkit-scrollbar-track { background: #222b3c; }
::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--tertiary-color); }

/* Preloader */
#preloader {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-color-light-theme); /* Use theme variable */
    z-index: 10000; display: flex; flex-direction: column;
    align-items: center; justify-content: center; transition: opacity 0.5s ease;
}
body.dark-mode #preloader { background-color: var(--bg-color-dark-theme); }
#preloader .spinner-border { width: 4rem; height: 4rem; color: var(--primary-color); }
#preloader p {
    margin-top: 20px; font-weight: 600;
    color: var(--text-color-light-theme); /* Use theme variable */
    animation: pulse 1.5s infinite ease-in-out;
}
body.dark-mode #preloader p { color: var(--text-color-dark-theme); }
body.loaded #preloader { opacity: 0; visibility: hidden; pointer-events: none; }


/* Navigation */
.navbar {
    /* Default light mode navbar bg is darkish */
    background-color: rgba(33, 37, 41, 0.95); /* Corresponds to Bootstrap's .bg-dark */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    transition: background-color var(--transition-speed) ease;
}
body.dark-mode .navbar {
    background-color: rgba(26, 32, 44, 0.95); /* Even darker for dark mode */
}
.navbar-brand {
    font-weight: 700;
    color: #f8f9fa !important; /* Light text for dark navbar bg */
    font-size: 1.6rem; letter-spacing: 1px;
}
/* body.dark-mode .navbar-brand - no change needed if navbar bg remains darkish */

.nav-link {
    color: #adb5bd !important; /* Lighter gray for readability on dark navbar */
    font-weight: 500; margin: 0 12px; position: relative;
    transition: color var(--transition-speed) ease;
    text-transform: uppercase; font-size: 0.9rem; letter-spacing: 0.5px;
}
/* body.dark-mode .nav-link - no change needed if navbar bg remains darkish */
.nav-link:hover, .nav-link.active, .footlink.active {
  color: var(--secondary-color);
  text-shadow:
    0 0 10px rgba(52, 211, 153, 0.5),
    0 0 20px rgba(52, 211, 153, 0.8),
    0 0 20px rgba(15, 250, 170, 0.2),
    0 0 10px rgba(15, 250, 170, 0.3);
}
    .nav-link.active {
  will-change: text-shadow;
  animation: pulse-glow 2s ease-in-out infinite alternate;
}

/* Keyframes to pulse between a stronger and a softer glow */
@keyframes pulse-glow {
  from {
    text-shadow:
      0 0 2px #fff,
      0 0 8px var(--secondary-color),
      0 0 16px var(--secondary-color),
      0 0 24px rgba(15, 250, 170, 0.5),
      0 0 32px rgba(15, 250, 170, 0.3);
  }
  to {
    text-shadow:
      0 0 6px #fff,
      0 0 12px var(--secondary-color),
      0 0 24px var(--secondary-color),
      0 0 36px rgba(15, 250, 170, 0.7),
      0 0 48px rgba(15, 250, 170, 0.5);
  }
}

.nav-link::before {
    content: ""; position: absolute; width: 0; height: 3px; bottom: -5px; left: 50%;
    transform: translateX(-50%); background-color: var(--secondary-color);
    border-radius: 2px; transition: width var(--transition-speed) ease;
}
.nav-link:hover::before, .nav-link.active::before { width: 80%; }
/* Navbar dropdown menu in dark mode */
body.dark-mode .dropdown-menu {
    background-color: #2d3748; /* Dark background for dropdown */
    border-color: #4a5568;
}
body.dark-mode .dropdown-item {
    color: #a0aec0; /* Light text for dropdown items */
}
body.dark-mode .dropdown-item:hover, body.dark-mode .dropdown-item:focus {
    background-color: #4a5568; /* Darker hover for dropdown items */
    color: #e2e8f0;
}

@media (hover: hover) and (pointer: fine) {
      .dropdown:hover > .dropdown-menu {
        display: block;
      }
      .dropdown > .dropdown-toggle:active {
        pointer-events: none;
      }
    }


/* Hero Section */
/* The #particles-js div will be created by three_hero_bg.js if used, or particles.js */
/* If using Three.js for hero, #particles-js might be replaced or supplemented */
#hero-three-container { /* New for Three.js */
    position: absolute; width: 100%; height: 100%; top: 0; left: 0; z-index: 0;
    /* Gradient will be covered by Three.js canvas, but good fallback */
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
}
body.dark-mode #hero-three-container {
    background: linear-gradient(135deg, #0f131a 0%, #1a202c 100%);
}
/* Particles specific if still used with Three.js or as fallback */
#particles-js { position: absolute; width: 100%; height: 100%; top: 0; left: 0; z-index: 0;}


.hero {
    min-height: 100vh; display: flex; align-items: center;
    position: relative; overflow: hidden;
    color: var(--text-on-dark-elements); /* Text on Hero is usually light */
    padding-top: 80px; /* Consider navbar height */
}
/* body.dark-mode .hero color remains the same as it's on a dark bg */

.hero-content { z-index: 2; }
.hero h1 {
    font-size: calc(2.5rem + 2vw); font-weight: 700; margin-bottom: 20px;
    line-height: 1.2; animation: fadeInDown 1s ease-out;
    color: var(--text-on-dark-elements); /* Ensure light text */
}
.hero h1 span { color: var(--primary-color); display: inline-block; animation: bounceIn 1s 0.5s ease-out; }
/* body.dark-mode .hero h1 span - primary-color will adapt */

.hero .lead {
    font-size: calc(1rem + 0.5vw); margin-bottom: 30px;
    color: #ced4da; /* Lighter gray for subheading on dark bg */
    animation: fadeInUp 1s 0.3s ease-out;
}
/* body.dark-mode .hero .lead color no change needed */

.hero .typing-text {
    font-family: 'Roboto Mono', monospace; font-size: calc(1rem + 0.3vw);
    color: var(--secondary-color); font-weight: 600; min-height: 30px;
    animation: fadeInUp 1s 0.6s ease-out;
}
/* body.dark-mode .hero .typing-text - secondary-color will adapt */

.hero-image { position: relative; z-index: 1; text-align: center; }
.hero-image img {
    max-width: 80%; height: auto; border-radius: 50%;
    border: 8px solid rgba(255, 255, 255, 0.1); /* Light border on dark bg */
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    animation: float 4s ease-in-out infinite;
}
@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-25px) rotate(3deg); } 100% { transform: translateY(0px); } }
/* body.dark-mode .hero-image img border can remain same or be slightly darker if desired */
/* @keyframes float - already defined, no change */

.hero-buttons .btn {
    margin-right: 15px; margin-bottom: 10px; padding: 12px 30px; font-weight: 600;
    border-radius: 50px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-speed) ease;
    text-transform: uppercase; letter-spacing: 1px;
    animation: fadeInUp 1s 0.9s ease-out;
}
.btn-primary {
    background-color: var(--primary-color); border-color: var(--primary-color); color: white;
}
.btn-secondary {
    background-color: var(--secondary-color); border-color: var(--secondary-color); color: white;
}
.btn-primary:hover {
    background-color: color-mix(in srgb, var(--primary-color) 80%, black);
    border-color: color-mix(in srgb, var(--primary-color) 80%, black);
    transform: translateY(-5px) scale(1.05); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}
.btn-secondary:hover {
    background-color: color-mix(in srgb, var(--secondary-color) 80%, black);
    border-color: color-mix(in srgb, var(--secondary-color) 80%, black);
    transform: translateY(-5px) scale(1.05); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* Section Styles */
.section { padding: 100px 0; }
.section.bg-alt { background-color: var(--light-color); } /* Light gray in light mode, dark card-like in dark */
/* body.dark-mode .section.bg-alt { background-color: #222b3c; } // var(--light-color) will handle this */

.section-title { text-align: center; margin-bottom: 70px; position: relative; }
.section-title h2 {
    font-size: 2.8rem; font-weight: 700; text-transform: uppercase;
    margin-bottom: 20px;
    color: var(--text-color-light-theme); /* Main text color */
    position: relative; display: inline-block; padding-bottom: 15px; letter-spacing: 1px;
}
body.dark-mode .section-title h2 { color: var(--text-color-dark-theme); }

.section-title h2::after {
    content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 80px; height: 5px; background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px; animation: pulse 2s infinite;
}
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
/* @keyframes pulse - already defined */
.section-title p.subtitle {
    font-size: 1.1rem; color: #6c757d; /* Subdued text color */
    max-width: 600px; margin: 10px auto 0;
}
body.dark-mode .section-title p.subtitle { color: #a0aec0; } /* Lighter subdued for dark mode */

/* About Section */
.about-content {
    background-color: var(--bg-color-light-theme); /* White in light mode */
    border-radius: var(--border-radius); padding: 40px; box-shadow: var(--box-shadow);
    transition: all var(--transition-speed) ease; margin-bottom: 30px;
}
body.dark-mode .about-content { background-color: var(--light-color); } /* Card color in dark mode */

.about-content:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}
body.dark-mode .about-content:hover { box-shadow: 0 20px 40px rgba(0,0,0,0.5); }

.about-content p { line-height: 1.8; margin-bottom: 15px; }
.about-content strong { color: var(--primary-color); font-weight: 600; }
.about-image img {
    border-radius: var(--border-radius); box-shadow: var(--box-shadow);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    width: 100%; height: auto;
}
.about-image img:hover { transform: rotate(-3deg) scale(1.05); }
.random-fact-display {
    background-color: var(--light-color); /* Light gray in light, dark card in dark */
    color: var(--text-color-light-theme); /* Main text in light */
    border-left: 5px solid var(--accent-color); padding: 25px; margin-top: 40px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); font-style: italic;
}
body.dark-mode .random-fact-display {
    /* background-color: #2d3748; // Handled by var(--light-color) in dark mode */
    color: var(--text-color-dark-theme); /* Main text in dark */
    border-left-color: var(--accent-color);
}
.random-fact-display strong {
    display: block; margin-bottom: 10px; font-style: normal;
    color: var(--accent-color); font-weight: 700;
}


/* Education Section Layout */
.education-entry { margin-bottom: 50px; }
.education-item {
    background-color: var(--bg-color-light-theme); /* White in light */
    border-radius: var(--border-radius); padding: 30px; box-shadow: var(--box-shadow);
    transition: all var(--transition-speed) ease; height: 100%;
    display: flex; flex-direction: column;
}
body.dark-mode .education-item { background-color: var(--light-color); } /* Dark card in dark */

.education-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}
body.dark-mode .education-item:hover { box-shadow: 0 15px 35px rgba(0,0,0,0.5); }

.education-item h3 { color: var(--primary-color); font-weight: 700; margin-bottom: 5px; font-size: 1.4rem; }
.education-item .status { color: var(--tertiary-color); font-weight: 600; font-size: 0.9rem; margin-bottom: 10px; display: block; }
.education-item .years {
    color: var(--text-color-light-theme); /* Main text */
    font-weight: 600; font-size: 0.9rem; opacity: 0.8;
}
body.dark-mode .education-item .years { color: var(--text-color-dark-theme); }

.education-item .institution {
    font-weight: 600;
    color: var(--text-color-light-theme); /* Main text */
    margin: 10px 0;
}
body.dark-mode .education-item .institution { color: var(--text-color-dark-theme); }

.education-item .percentage, .education-item .nirf-ranking {
    display: inline-block; padding: 5px 15px;
    background-color: var(--light-color); /* Light gray in light, dark card in dark */
    border-radius: 50px; font-weight: 600;
    color: var(--text-color-light-theme); /* Main text */
    margin-top: 10px; font-size: 0.85rem; margin-right: 5px;
    border: 1px solid #eee; /* Light border in light mode */
}
body.dark-mode .education-item .percentage, body.dark-mode .education-item .nirf-ranking {
    /* background-color: #4a5568; // Handled by var(--light-color) */
    color: var(--text-color-dark-theme); /* Main text */
    border-color: #5a6578; /* Darker border for dark mode */
}
.education-image-container { display: flex; align-items: center; justify-content: center; height: 100%; }
.education-image {
    max-width: 100%; max-height: 300px; border-radius: var(--border-radius);
    object-fit: cover; box-shadow: var(--box-shadow); transition: transform 0.3s ease;
}
.education-image-container:hover .education-image { transform: scale(1.05); }


/* Skills Section */
.skills-container {
    background-color: var(--bg-color-light-theme); /* White in light */
    border-radius: var(--border-radius); padding: 50px; box-shadow: var(--box-shadow);
}
body.dark-mode .skills-container { background-color: var(--light-color); } /* Dark card in dark */

.skill-category { margin-bottom: 40px; }
.skill-category h3 {
    color: var(--text-color-light-theme); /* Main text */
    font-weight: 700; margin-bottom: 25px; padding-bottom: 10px;
    border-bottom: 3px dashed var(--light-color); /* Light gray border in light, dark in dark */
    display: inline-block;
}
body.dark-mode .skill-category h3 {
    color: var(--text-color-dark-theme); /* Main text */
    /* border-bottom-color: #4a5568; // Handled by var(--light-color) */
}
.skill-tag {
    display: inline-block; padding: 10px 20px;
    background-color: var(--light-color); /* Light gray in light, dark card in dark */
    color: var(--text-color-light-theme); /* Main text */
    border-radius: 50px; font-weight: 500; margin-right: 10px; margin-bottom: 15px;
    transition: all var(--transition-speed) ease; cursor: default;
    border: 1px solid transparent; font-size: 0.95rem;
}
.skill-tag:hover {
    background-color: var(--primary-color); color: white;
    transform: translateY(-5px) rotate(2deg);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}
body.dark-mode .skill-tag {
    /* background-color: #4a5568; // Handled by var(--light-color) */
    color: var(--text-color-dark-theme); /* Main text */
    border-color: var(--light-color); /* Matches its own bg, so seems transparent */
}
body.dark-mode .skill-tag:hover {
    background-color: var(--primary-color); color: white;
    border-color: var(--primary-color);
}

/* Projects Section */
.project-card {
    border-radius: var(--border-radius); overflow: hidden; box-shadow: var(--box-shadow);
    margin-bottom: 30px; background-color: var(--bg-color-light-theme); /* White in light */
    transition: all var(--transition-speed) ease;
    display: flex; flex-direction: column; height: 100%;
}
body.dark-mode .project-card { background-color: var(--light-color); } /* Dark card in dark */

.project-card:hover {
    transform: translateY(-12px) scale(1.03);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}
body.dark-mode .project-card:hover { box-shadow: 0 25px 50px rgba(0,0,0,0.6); }

.project-card .card-img-top {
    height: 250px; object-fit: cover;
    border-bottom: 1px solid var(--light-color); /* Light gray border in light, dark in dark */
    filter: grayscale(30%); transition: filter var(--transition-speed) ease;
}
/* body.dark-mode .project-card .card-img-top { border-bottom-color: #4a5568; // Handled by var(--light-color) } */
.project-card:hover .card-img-top { filter: grayscale(0%); }

.project-card .card-body { padding: 30px; display: flex; flex-direction: column; flex-grow: 1; }
.project-card .card-title {
    font-weight: 700; color: var(--text-color-light-theme); /* Main text */
    margin-bottom: 15px; font-size: 1.3rem;
}
body.dark-mode .project-card .card-title { color: var(--text-color-dark-theme); }

.project-card .card-text {
    color: var(--text-color-light-theme); /* Main text */
    margin-bottom: 20px; flex-grow: 1; font-size: 0.95rem; line-height: 1.6;
}
body.dark-mode .project-card .card-text { color: var(--text-color-dark-theme); }

.project-card .tech-stack { margin-bottom: 25px; }
.project-card .tech-stack span {
    display: inline-block; padding: 6px 12px;
    background-color: var(--light-color); /* Light gray in light, dark card in dark */
    color: var(--text-color-light-theme); /* Main text */
    border-radius: 5px; font-size: 0.8rem; margin-right: 5px; margin-bottom: 5px;
    font-weight: 500; border: 1px solid #eee; /* Light border */
}
body.dark-mode .project-card .tech-stack span {
    /* background-color: #4a5568; // Handled by var(--light-color) */
    color: var(--text-color-dark-theme); /* Main text */
    border-color: #5a6578; /* Darker border */
}
.project-card .btn {
    padding: 10px 25px; border-radius: 50px; font-weight: 600;
    text-transform: uppercase; font-size: 0.9rem; letter-spacing: 0.5px;
    align-self: flex-start; margin-top: auto;
}



/* Interactive IoT Demo */
#iot-demo { text-align: center; } /* This ID might be within a page now */
.iot-device {
    display: inline-block; vertical-align: top; margin: 15px; padding: 25px;
    background-color: var(--bg-color-light-theme); /* White in light */
    border-radius: var(--border-radius); box-shadow: var(--box-shadow);
    transition: all var(--transition-speed) ease; text-align: center; width: 170px;
}
body.dark-mode .iot-device { background-color: var(--light-color); } /* Dark card in dark */

.iot-device:hover { transform: translateY(-8px); }
.iot-icon {
    font-size: 3.5rem; margin-bottom: 15px;
    transition: color var(--transition-speed) ease, transform var(--transition-speed) ease;
    color: #adb5bd; /* Neutral icon color */
}
.iot-icon.on {
    color: var(--accent-color);
    text-shadow: 0 0 15px color-mix(in srgb, var(--accent-color) 50%, transparent);
    transform: scale(1.1);
    animation: glow 3s ease-in-out infinite;
}
@keyframes glow {0%   { transform: scale(1); } 50%  { transform: scale(1.1); /* grow to 110% */ } 100% { transform: scale(1); }}
.iot-icon.fan.on { animation: spin 2s linear infinite; } 
@keyframes spin { 0% { transform: rotate(0deg) scale(1.1); } 100% { transform: rotate(360deg) scale(1.1); } }   
/* @keyframes spin - already defined */
.iot-device h4 {
    margin-bottom: 15px; font-weight: 600;
    color: var(--text-color-light-theme); /* Main text */
    font-size: 1.1rem;
}
body.dark-mode .iot-device h4 { color: var(--text-color-dark-theme); }
.iot-device .btn-iot { width: 100px; padding: 8px 15px; font-weight: 600; } /* Button styling will use .btn-primary, .btn-outline-primary */
.iot-status {
    font-size: 0.9rem; margin-top: 10px; font-weight: bold;
    transition: color var(--transition-speed) ease; color: #dc3545; /* Default OFF color (reddish) */
}
.iot-status.on { color: var(--secondary-color); }
#iot-reveal {
    margin-top: 40px; font-style: italic; opacity: 0;
    transition: opacity 1s ease 0.5s;
}
#iot-reveal.revealed { opacity: 1; }


/* Contact Section (if used as a standalone section, not just contact_page.php) */
/* Assuming #contact-section ID */
.contact-info, .contact-form { /* These classes are used in templates/contact_form_section.php */
    background-color: var(--bg-color-light-theme); /* White in light */
    border-radius: var(--border-radius); padding: 40px; box-shadow: var(--box-shadow);
    height: 100%;
}
body.dark-mode .contact-info, body.dark-mode .contact-form {
    background-color: var(--light-color); /* Dark card in dark */
}
.contact-info h3, .contact-form h3 {
    color: var(--text-color-light-theme); /* Main text */
    font-weight: 700; margin-bottom: 30px;
}
body.dark-mode .contact-info h3, body.dark-mode .contact-form h3 {
    color: var(--text-color-dark-theme);
}

.contact-item {
    margin-bottom: 30px; position: relative; padding-left: 65px;
    min-height: 50px; display: flex; flex-direction: column; justify-content: center;
}
.contact-item i {
    position: absolute; left: 0; top: 0; width: 50px; height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white; border-radius: 50%; font-size: 1.4rem;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
.contact-item:hover i {
    transform: rotateY(360deg) scale(1.1);
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}
.contact-item h4 {
    font-size: 1.1rem; font-weight: 600;
    color: var(--text-color-light-theme); /* Main text */
    margin-bottom: 5px;
}
body.dark-mode .contact-item h4 { color: var(--text-color-dark-theme); }

.contact-item p, .contact-item a {
    color: var(--text-color-light-theme); /* Main text */
    margin-bottom: 0; text-decoration: none;
    transition: color var(--transition-speed) ease; word-break: break-word;
}
body.dark-mode .contact-item p, body.dark-mode .contact-item a {
    color: var(--text-color-dark-theme);
}
.contact-item a:hover { color: var(--primary-color) !important; }

.form-control {
    border-radius: 10px; padding: 15px; border: 1px solid #dee2e6; /* Light border */
    margin-bottom: 20px; transition: all var(--transition-speed) ease;
    background-color: var(--bg-color-light-theme); /* White bg for form in light */
    color: var(--text-color-light-theme); /* Dark text for form in light */
}
body.dark-mode .form-control {
    background-color: #2d3748; /* Darker input bg in dark mode */
    border-color: #4a5568; /* Darker border */
    color: var(--text-on-light-elements); /* Light text for form in dark */
}
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(var(--rgb-primary), 0.25);
    background-color: var(--bg-color-light-theme); /* Keep bg same on focus for light */
}
body.dark-mode .form-control:focus {
    background-color: #2d3748; /* Keep bg same on focus for dark */
    border-color: var(--primary-color);
}
.contact-form .btn { /* This is the submit button */
    padding: 12px 30px; font-weight: 600; border-radius: 50px;
    transition: all var(--transition-speed) ease;
}
.contact-form .btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}


/* Footer */
footer {
    background-color: #212529; /* Dark footer bg in light mode */
    color: #adb5bd; /* Light text on dark footer */
    padding: 60px 0 30px;
}
body.dark-mode footer { background-color: #1a202c; } /* Even darker footer in dark mode */

.footer-links a {
    color: #ced4da; text-decoration: none; margin: 0 15px;
    transition: color var(--transition-speed) ease; font-weight: 500;
}
.footer-links a:hover { color: var(--secondary-color); }

.social-links { margin-top: 25px; margin-bottom: 25px; }
.social-links a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 45px; height: 45px;
    background-color: rgba(255, 255, 255, 0.1); /* Semi-transparent white on dark footer */
    color: #f8f9fa; /* Light icon color */
    border-radius: 50%; margin: 0 8px;
    transition: all var(--transition-speed) ease; font-size: 1.2rem;
}
body.dark-mode .social-links a {
    background-color: rgba(255, 255, 255, 0.05); /* Even more transparent */
    /* color: var(--dark-color); // This was for dark mode text, but icons are on dark bg, so keep light */
}
.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-5px) rotate(15deg); color: white;
}
/* body.dark-mode .social-links a:hover color: white; is fine */

.copyright {
    margin-top: 30px; padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1); /* Light border on dark footer */
    font-size: 0.9rem;
}
body.dark-mode .copyright { border-top-color: rgba(255, 255, 255, 0.08); }
.copyright i.fa-heart { transition: color 0.3s ease; }
.copyright:hover i.fa-heart { color: red !important; }


/* Back to Top Button */
.back-to-top {
    position: fixed; right: 25px; bottom: 25px; width: 50px; height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    opacity: 0; visibility: hidden; border: none; z-index: 999;
    transform: translateY(100px);
    transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease, transform 0.4s ease-out;
}
.back-to-top.active { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover {
    transform: scale(1.1) translateY(0);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}


/* Theme Switcher */
.theme-switcher {
    position: fixed; right: 25px; top: 90px; /* Adjust if overlaps with fixed navbar */
    z-index: 999;
    background-color: var(--bg-color-light-theme); /* White in light */
    border-radius: 50%; width: 50px; height: 50px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15); cursor: pointer;
    transition: all var(--transition-speed) ease, transform 0.5s ease;
    border: 1px solid var(--light-color); /* Light gray border in light, dark in dark */
}
.theme-switcher i { font-size: 1.4rem; color: var(--primary-color); transition: transform 0.5s ease; }
.theme-switcher:hover { transform: rotate(360deg); }
body.dark-mode .theme-switcher {
    background-color: var(--light-color); /* Dark card color for switcher bg */
    /* border-color: #4a5568; // Handled by var(--light-color) */
}
/* body.dark-mode .theme-switcher i color var(--primary-color) is fine */


/* --- NEW STYLES FOR BLOG, GALLERY, PUBLICATIONS, DASHBOARD --- */

/* Blog Page */
.blog-post-summary {
    background-color: var(--bg-color-light-theme);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--box-shadow);
    transition: all var(--transition-speed) ease;
}
body.dark-mode .blog-post-summary { background-color: var(--light-color); }
.blog-post-summary:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}
body.dark-mode .blog-post-summary:hover { box-shadow: 0 15px 30px rgba(0,0,0,0.4); }

.blog-post-summary h3 a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}
.blog-post-summary h3 a:hover { color: var(--secondary-color); }
.blog-post-meta {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 15px;
}
body.dark-mode .blog-post-meta { color: #a0aec0; }
.blog-post-excerpt { margin-bottom: 20px; }

/* Single Blog Post Page */
.single-blog-post-content {
    background-color: var(--bg-color-light-theme);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    line-height: 1.8;
}
body.dark-mode .single-blog-post-content { background-color: var(--light-color); }
.single-blog-post-content img { /* Responsive images in posts */
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin: 20px 0;
}
.single-blog-post-content h1, .single-blog-post-content h2, .single-blog-post-content h3 {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    color: var(--primary-color);
}
.single-blog-post-content h1 { font-size: 2.2em; }
.single-blog-post-content h2 { font-size: 1.8em; }
.single-blog-post-content h3 { font-size: 1.5em; }



/* Gallery Page */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    cursor: pointer;
}
.gallery-item img {
    width: 100%;
    height: 250px; /* Or use aspect-ratio */
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.gallery-item:hover img { transform: scale(1.1); }
.gallery-item-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 0.9em;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.gallery-item:hover .gallery-item-caption {
    opacity: 1;
    transform: translateY(0);
}
/* Lightbox styles (basic example, use a library for full features) */
.lightbox-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    display: none; /* Initially hidden */
    align-items: center;
    justify-content: center;
    z-index: 10001; /* Above preloader if active during load */
}
.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}
.lightbox-content img {
    display: block;
    max-width: 100%;
    max-height: 80vh; /* Leave space for caption */
    border-radius: var(--border-radius);
}
.lightbox-caption {
    color: white;
    text-align: center;
    padding: 15px;
    font-size: 1.1em;
}
.lightbox-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
}



/* Publications Page */
.publication-entry {
    background-color: var(--bg-color-light-theme);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--box-shadow);
}
body.dark-mode .publication-entry { background-color: var(--light-color); }
.publication-entry h3 { color: var(--primary-color); margin-bottom: 10px; }
.publication-authors { font-style: italic; margin-bottom: 10px; color: #555; }
body.dark-mode .publication-authors { color: #bbb; }
.publication-venue { font-weight: bold; margin-bottom: 15px; }
.publication-abstract {
    margin-bottom: 15px;
    border-left: 3px solid var(--secondary-color);
    padding-left: 15px;
    font-size: 0.95em;
}
.publication-links a {
    margin-right: 15px;
    font-weight: 500;
}

/* Dashboard Page (for widgets) */
.dashboard-widget {
    background-color: var(--bg-color-light-theme);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}
body.dark-mode .dashboard-widget { background-color: var(--light-color); }
.dashboard-widget h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}
.widget-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--secondary-color);
    text-align: center;
    margin-bottom: 10px;
}
.widget-label {
    text-align: center;
    font-size: 1.1em;
    color: #6c757d;
}
body.dark-mode .widget-label { color: #a0aec0; }
.chart-container {
    position: relative;
    /* height:300px; /* Or adjust as needed */
    /* width:100%; */
}


/* Miscellaneous Page - Food for Thought (Quotes) */
.quote-block {
    background-color: var(--light-color); /* Light gray in light, dark card in dark */
    padding: 25px;
    border-left: 5px solid var(--tertiary-color);
    margin-bottom: 30px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    box-shadow: var(--box-shadow);
}
/* body.dark-mode .quote-block already covered by var(--light-color) */
.quote-text {
    font-size: 1.2em;
    font-style: italic;
    margin-bottom: 15px;
    line-height: 1.6;
}
.quote-author {
    text-align: right;
    font-weight: bold;
    color: var(--tertiary-color);
}
.quote-timestamp {
    text-align: right;
    font-size: 0.8em;
    color: #777;
    margin-top: 5px;
}
body.dark-mode .quote-timestamp { color: #aaa; }

/* CV Download Button */
.cv-download-btn { /* Style like other .btn */
    margin: 20px 0;
}

.unstyled-link {
    all: unset;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-speed), text-shadow var(--transition-speed);
}

.unstyled-link:hover {
    color: var(--bs-link-hover-color, #f8f9fa); /* fallback included */
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.25); /* subtle glow */
     text-decoration: underline;
}



/* Responsive Adjustments */
/* All existing @media queries should be kept and tested. */
/* Add any new ones needed for the new page layouts. */
@media (max-width: 991.98px) {
    .hero h1 { font-size: calc(2rem + 3vw); }
    .hero .lead { font-size: calc(0.9rem + 0.8vw); }
    .hero-image img { max-width: 70%; margin-top: 30px; }
    .education-entry .row { display: flex; flex-direction: column; }
    .education-entry .order-md-1, .education-entry .order-md-2 { order: 0 !important; }
    .education-image-container { margin-top: 20px; }
    .education-item { margin-bottom: 20px; }
}
@media (max-width: 767.98px) {
    .navbar-collapse {
        background-color: #212529; /* Dark bg for collapsed menu */
        padding: 15px; margin-top: 10px; border-radius: 10px;
        border: 1px solid rgba(255,255,255,0.1);
    }
    body.dark-mode .navbar-collapse {
        background-color: #2d3748;
        border-color: rgba(255,255,255,0.1);
    }
    .nav-link { margin: 8px 0; padding: 5px; }
    .hero { text-align: center; }
    .hero .row { flex-direction: column-reverse; } /* Image below text */
    .hero-image img { max-width: 60%; }
    .hero-buttons { text-align: center; }
    .hero-buttons .btn { display: block; margin: 10px auto; width: 70%; }
    .section { padding: 80px 0; }
    .section-title h2 { font-size: 2.2rem; }
    .contact-info, .contact-form { margin-bottom: 30px; } /* For contact_form_section */
    .iot-device { width: calc(50% - 30px); }
}
@media (max-width: 575.98px) {
    .footer-links a { display: block; margin: 8px 0;}
    .social-links a { width: 40px; height: 40px; font-size: 1rem;}
    .iot-device { width: calc(100% - 30px); }
    .hero h1 { font-size: calc(1.8rem + 4vw); }
    .hero .lead { font-size: calc(0.9rem + 1vw); }
}


/* --- END OF style.css --- */