:root {
    /* Default theme variables (light background, dark text) */
    --primary-color: #333333; /* Dark text for light default background */
    --secondary-color: #666666; /* Slightly lighter dark text */
    --accent-color: #9b59b6; /* A slightly softer purple */
    --background-start: #8EC5FC; /* Light blue */
    --background-end: #E0C3FC; /* Light purple */
    --card-bg-alpha: 0.18;
    --border-alpha: 0.35;
    --blur-intensity: 15px;
    --shadow-intensity: 0.25;
    --base-font-family: 'Poppins', sans-serif; /* New font variable */
}

/* Define alternative themes */
.theme-green {
    --background-start: #D9E7D0; /* Light green */
    --background-end: #A8D1A0; /* Medium green */
    --accent-color: #6B8E23; /* Olive green */
    --primary-color: #2e3d2e; /* Darker text for light background */
    --secondary-color: #556b2f; /* Darker secondary for contrast */
}

.theme-orange {
    --background-start: #FFDAB9; /* Peach */
    --background-end: #FFA07A; /* Light salmon */
    --accent-color: #FF6347; /* Tomato */
    --primary-color: #4a2a1a; /* Darker text for light background */
    --secondary-color: #8b4513; /* Darker secondary for contrast */
}

.theme-dark {
    --primary-color: #e0e0e0; /* Light text for dark background */
    --secondary-color: #b0b0b0; /* Slightly darker light text */
    --accent-color: #7a42b8; /* Darker purple accent */
    --background-start: #2c3e50; /* Dark blue-grey */
    --background-end: #34495e; /* Slightly lighter dark blue-grey */
    --card-bg-alpha: 0.15;
    --border-alpha: 0.3;
    --blur-intensity: 15px;
    --shadow-intensity: 0.3;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--base-font-family); /* Use the new font variable */
    background: linear-gradient(135deg, var(--background-start), var(--background-end));
    background-attachment: fixed; /* Key for parallax effect: background stays fixed */
    color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1.5rem; /* Increased default padding */
    position: relative;
    overflow-x: hidden;
    transition: background 0.5s ease-in-out, color 0.5s ease-in-out, font-family 0.3s ease; /* Smooth transition for theme and font change */
}

/* Decorative background shapes for parallax effect */
body::before, body::after, .background-shape-extra {
    content: '';
    position: fixed;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    filter: blur(60px);
    z-index: 0;
}

body::before {
    width: 350px;
    height: 350px;
    top: 8%;
    left: 8%;
    background: rgba(255, 255, 255, 0.08);
    filter: blur(70px);
}

body::after {
    width: 300px;
    height: 300px;
    bottom: 12%;
    right: 12%;
    background: rgba(255, 255, 255, 0.12);
    filter: blur(50px);
}

.background-shape-extra {
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.05);
    filter: blur(90px);
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 1100px;
    z-index: 1;
    position: relative;
}

/* Glassmorphism Card Style */
.glass-card {
    background: rgba(255, 255, 255, var(--card-bg-alpha));
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, var(--border-alpha));
    padding: 3rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, var(--shadow-intensity));
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.5s ease-in-out, border-color 0.5s ease-in-out;
}

.glass-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 50px 0 rgba(0, 0, 0, calc(var(--shadow-intensity) + 0.1));
}

.header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 2rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.logo-container {
    position: relative; /* Added for absolute positioning of the toggle button */
    flex-shrink: 0;
}

.portfolio-logo {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

/* Profile Picture */
.profile-pic {
    width: 250px;
    height: 250px;
    border-radius: 50%; /* Make it circular */
    object-fit: cover;
    margin-bottom: 2rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    border: 5px solid rgba(255, 255, 255, 0.8); /* White border */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-pic:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.25);
}

/* Navigation Bar */
.navbar {
    flex-grow: 1; /* Allow navbar to take available space */
    display: flex;
    /* justify-content: center; removed from here, moved to media query for desktop */
    align-items: center;
}

.navbar ul {
    list-style: none;
    display: flex;
    gap: 1.5rem; /* Reduced gap for a tighter, more button-like feel */
    padding: 0;
    margin: 0;
}

.navbar a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem; /* Slightly smaller font for compact look */
    position: relative;
    transition: color 0.3s ease, background-color 0.3s ease, transform 0.2s ease, border-radius 0.3s ease;
    padding: 0.6rem 1.2rem; /* Added padding to make links feel like buttons */
    border-radius: 15px; /* Rounded corners for the links */
    display: block; /* Ensures padding and border-radius apply correctly */
}

.navbar a::after {
    content: '';
    position: absolute;
    width: calc(100% - 1.2rem); /* Adjust width to match padding */
    height: 2px;
    bottom: 5px; /* Position above the bottom edge of the padded link */
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--accent-color);
    transition: width 0.3s ease;
    opacity: 0; /* Hidden by default */
}

.navbar a:hover {
    color: var(--accent-color);
    background-color: rgba(255, 255, 255, 0.1); /* Subtle background on hover */
    transform: translateY(-2px); /* Slight lift on hover */
}
.navbar a:hover::after {
    width: calc(100% - 1.2rem); /* Full width on hover */
    opacity: 1; /* Show underline on hover */
}

/* Hamburger menu styles */
.hamburger-menu {
    display: none; /* Hidden by default on larger screens */
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    cursor: pointer;
    z-index: 100; /* Ensure it's above other elements */
    position: absolute; /* Position relative to header-top-row */
    right: 0; /* Align to the right */
    top: 50%;
    transform: translateY(-50%);
}

.hamburger-menu span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}

/* Animation for hamburger to close icon */
.hamburger-menu.open span:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.hamburger-menu.open span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.open span:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    line-height: 1.2;
}

.subtitle {
    font-size: 1.3rem;
    font-weight: 300;
    color: var(--secondary-color);
    opacity: 0.9;
}

h2 {
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 1.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

p {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--secondary-color);
    opacity: 0.85;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.project-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 2rem;
    text-align: center;
    transition: background 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.project-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-5px);
}

.project-icon {
    font-size: 3rem;
    margin-bottom: 1.2rem;
    color: var(--accent-color);
    text-shadow: 0 0 15px rgba(155, 89, 182, 0.6);
}

h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.7rem;
}

.interests-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.interest-tag {
    background: var(--accent-color);
    color: var(--primary-color);
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 400;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, background 0.2s ease;
}

.interest-tag:hover {
    transform: translateY(-3px);
    background: #a569bd;
}

.contact-section {
    text-align: center;
}

.social-links {
    margin-top: 2rem;
}

.social-links a {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin: 0 1.2rem;
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-block;
}

.social-links a:hover {
    color: var(--accent-color);
    transform: scale(1.2);
}

.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scroll to Top Button Styles */
#scrollToTopBtn {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.8rem;
    color: var(--primary-color);
    cursor: pointer;
    text-align: center;
    line-height: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

#scrollToTopBtn.show {
    display: block;
    opacity: 1;
}

#scrollToTopBtn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-3px);
}

/* New combined button */
.fixed-custom-button {
    position: fixed;
    bottom: 30px;
    right: 100px; /* Adjusted to be left of scroll-to-top */
    z-index: 1001;
    background: var(--accent-color);
    color: var(--primary-color);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px; /* More like a button than a circle */
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease, transform 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.fixed-custom-button:hover {
    background: #a569bd;
    transform: translateY(-3px);
}

/* New combined panel */
.customization-panel {
    position: fixed;
    bottom: 90px; /* Above the button */
    right: 30px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateX(120%); /* Hidden by default */
    transition: transform 0.3s ease-out;
    display: flex; /* Use flexbox for internal layout */
    flex-direction: column;
    gap: 15px; /* Spacing between sections */
    max-height: 80vh; /* Limit height for smaller screens */
    overflow-y: auto; /* Enable scrolling if content overflows */
    width: 90%;
    max-width: 350px; /* Max width for the panel */
}

.customization-panel.open {
    transform: translateX(0);
}

.customization-panel h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 8px;
}

.customization-panel h4 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-top: 10px;
    margin-bottom: 5px;
}

.custom-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.custom-input-group input[type="url"],
.custom-input-group input[type="text"] {
    flex-grow: 1;
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
    outline: none;
    font-size: 0.9rem;
}

.custom-input-group label {
    color: var(--primary-color);
    font-size: 0.9rem;
    white-space: nowrap;
}

.predefined-themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 10px;
    justify-items: center;
}

.predefined-fonts-grid { /* Initially hidden */
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); /* Adjusted for font buttons */
    gap: 10px;
    justify-items: center;
    margin-top: 10px; /* Space from input */
}

.predefined-fonts-grid.show-grid { /* Class to show the grid */
    display: grid;
}

.color-option-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.color-option-btn:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

.color-option-btn.active {
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 0 3px var(--accent-color);
}

/* Specific background colors for color option buttons */
.color-option-btn.default { background: linear-gradient(135deg, #8EC5FC, #E0C3FC); }
.color-option-btn.green { background: linear-gradient(135deg, #D9E7D0, #A8D1A0); }
.color-option-btn.orange { background: linear-gradient(135deg, #FFDAB9, #FFA07A); }
.color-option-btn.dark { background: linear-gradient(135deg, #2c3e50, #34495e); }

/* Styles for font option buttons */
.font-option-btn {
    padding: 0.6rem 1rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis if text overflows */
}

.font-option-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.font-option-btn.active {
    background: var(--accent-color);
    color: white; /* Ensure text is visible on accent color */
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

#applyCustomColorBtn, #applySolidColorBtn, #resetThemeBtn, #applyLogoUrlBtn, #applyProfilePicBtn, #applyFontBtn {
    padding: 0.6rem 1rem; /* Adjust padding for consistency */
    font-size: 0.9rem;
    margin-top: 0.5rem; /* Add some top margin to separate from inputs */
    width: 100%; /* Make buttons full width in the panel */
    box-sizing: border-box; /* Include padding in width calculation */
}
#applySolidColorBtn { margin-top: 0; } /* Override for solid color button */
#resetThemeBtn {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(255, 255, 255, 0.3);
}
#resetThemeBtn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Styles for draggable elements */
.layout-edit-mode .glass-card {
    cursor: grab;
}

.layout-edit-mode .glass-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.layout-edit-mode .glass-card.drag-over-top,
.layout-edit-mode .glass-card.drag-over-bottom {
    border: 2px dashed var(--accent-color);
}
.layout-edit-mode .glass-card.drag-over-top {
    border-top: 4px dashed var(--accent-color); /* Stronger indicator for top half */
}
.layout-edit-mode .glass-card.drag-over-bottom {
    border-bottom: 4px dashed var(--accent-color); /* Stronger indicator for bottom half */
}


/* --- Responsive Adjustments --- */

@media (min-width: 769px) {
    .glass-card { padding: 3rem; padding-top: 35px; }
    h1 { font-size: 3.5rem; }
    .subtitle { font-size: 1.4rem; }
    h2 { font-size: 2.5rem; }
    .navbar ul { /* Ensure menu is horizontal on larger screens */
        display: flex !important; /* Override display:none from mobile styles */
        flex-direction: row;
    }
    .navbar {
        justify-content: flex-end; /* Align nav items to the right on desktop */
    }
}

@media (max-width: 768px) {
    body { padding: 1rem; }
    .glass-card { padding: 2rem; }
    h1 { font-size: 2.5rem; }
    .subtitle { font-size: 1.1rem; }
    h2 { font-size: 1.8rem; }
    p { font-size: 0.95rem; }
    
    .header-top-row { 
        flex-direction: row; /* Keep logo and hamburger on one row */
        justify-content: space-between; /* Space them out */
        align-items: center;
        position: relative; /* For positioning hamburger */
    }
    .navbar {
        position: absolute;
        top: 100%; /* Position below the header-top-row */
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.9); /* Semi-transparent background for menu */
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-radius: 0 0 15px 15px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        overflow: hidden;
        max-height: 0; /* Hidden by default */
        transition: max-height 0.3s ease-out;
    }

    .navbar.open {
        max-height: 200px; /* Adjust based on content height */
    }

    .navbar ul { 
        flex-direction: column; 
        gap: 0.5rem; /* Tighter spacing for mobile menu items */
        padding: 1rem 0;
        width: 100%;
        text-align: center;
    }
    .navbar a {
        padding: 0.8rem 1rem; /* Larger touch targets */
        font-size: 1rem;
    }
    .navbar a::after {
        bottom: 2px; /* Adjust underline position for mobile */
    }

    .hamburger-menu {
        display: flex; /* Show hamburger on smaller screens */
    }

    .logo-container { margin-bottom: 0; }
    .profile-pic { width: 130px; height: 130px; margin-bottom: 1.5rem; }
    .project-item { padding: 1.5rem; }
    .project-icon { font-size: 2.5rem; }
    h3 { font-size: 1.1rem; }
    .interests-list { gap: 0.75rem; }
    .interest-tag { padding: 0.5rem 1rem; font-size: 0.9rem; }
    .social-links a { font-size: 2rem; margin: 0 1rem; }
    body::before { width: 250px; height: 250px; top: 5%; left: 5%; filter: blur(60px); }
    body::after { width: 200px; height: 200px; bottom: 10%; right: 10%; filter: blur(40px); }
    .background-shape-extra { width: 300px; height: 300px; filter: blur(70px); }
    #scrollToTopBtn { width: 40px; height: 40px; font-size: 1.5rem; line-height: 40px; bottom: 20px; right: 20px; }
    .fixed-custom-button { width: auto; height: 40px; font-size: 1rem; bottom: 20px; right: 70px; padding: 0.6rem 1.2rem; }
    .customization-panel { bottom: 70px; right: 20px; padding: 10px; gap: 10px; max-width: 300px; }
    .customization-panel h3 { font-size: 1.3rem; }
    .customization-panel h4 { font-size: 1rem; }
    .color-option-btn { width: 35px; height: 35px; }
    .custom-input-group { flex-direction: column; align-items: flex-start; }
    .custom-input-group input[type="url"],
    .custom-input-group input[type="text"] { width: 100%; }
    #applyCustomColorBtn, #applySolidColorBtn, #resetThemeBtn, #applyLogoUrlBtn, #applyProfilePicBtn, #applyFontBtn { font-size: 0.8rem; padding: 0.5rem 0.8rem; }
}

@media (max-width: 480px) {
    body { padding: 0.8rem; }
    .glass-card { padding: 1.5rem; margin-bottom: 1.8rem; }
    h1 { font-size: 2rem; }
    .subtitle { font-size: 0.9rem; }
    h2 { font-size: 1.6rem; margin-bottom: 1.2rem; }
    p { font-size: 0.9rem; }
    .profile-pic { 
        width: 100px; 
        height: 100px; 
        margin-bottom: 1rem; 
    }
    .navbar ul { 
        flex-direction: column; 
        gap: 0.6rem; 
        justify-content: center; /* Centered on extra small screens */
    }
    .navbar a { font-size: 0.95rem; }
    .projects-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .project-item { padding: 1.2rem; }
    .project-icon { font-size: 2rem; }
    h3 { font-size: 1rem; }
    .interests-list { gap: 0.6rem; }
    .interest-tag { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
    .social-links a { font-size: 1.8rem; margin: 0 0.8rem; }
    body::before { width: 180px; height: 180px; filter: blur(50px); }
    body::after { width: 130px; height: 130px; filter: blur(30px); }
    .background-shape-extra { width: 200px; height: 200px; filter: blur(60px); }
    #scrollToTopBtn { width: 35px; height: 35px; font-size: 1.2rem; line-height: 35px; bottom: 15px; right: 15px; }
    .fixed-custom-button { width: auto; height: 35px; font-size: 0.9rem; bottom: 15px; right: 60px; padding: 0.5rem 1rem; }
    .customization-panel { bottom: 60px; right: 15px; padding: 8px; gap: 8px; max-width: 280px; }
    .customization-panel h3 { font-size: 1.2rem; }
    .customization-panel h4 { font-size: 0.9rem; }
    .color-option-btn { width: 30px; height: 30px; }
}
