:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #ec4899;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(99, 102, 241, 0.15);
    --shadow-lg: 0 20px 40px rgba(99, 102, 241, 0.2);
    --shadow-xl: 0 30px 60px rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] {
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --text-dark: #f1f5f9;
    --text-light: #cbd5e1;
    --bg-light: #0f172a;
    --bg-white: #1e293b;
    --border-color: #334155;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.5); }
    50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.8); }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

@keyframes bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-light) 0%, #f3f4f6 100%);
    color: var(--text-dark);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    background-attachment: fixed;
}

/* ========== App Layout ========== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: linear-gradient(-45deg, #6366f1, #ec4899, #f59e0b, #818cf8);
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
    color: white;
    padding: 4rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
}

.header-content h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    animation: float 3s ease-in-out infinite;
}

.header-content p {
    font-size: 1.2rem;
    opacity: 0.95;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.theme-toggle:active {
    transform: scale(0.98);
}

.app-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    padding: 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ========== Form Section ========== */
.form-section {
    flex: 1;
    animation: slide-in-left 0.7s ease-out;
}

.form-container {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.form-container:hover {
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.form-container h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

fieldset {
    border: none;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
}

fieldset:first-of-type {
    border-top: none;
    padding-top: 0;
}

legend {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1.2rem;
    padding: 0;
    position: relative;
}

legend::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.form-group {
    margin-bottom: 1.5rem;
    animation: slide-up 0.6s ease-out backwards;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }
.form-group:nth-child(5) { animation-delay: 0.5s; }
.form-group:nth-child(6) { animation-delay: 0.6s; }

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    background-color: var(--bg-light);
    color: var(--text-dark);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

.form-group input:hover,
.form-group textarea:hover {
    border-color: var(--primary-light);
    background-color: var(--bg-white);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--bg-white);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
    animation: slide-up 0.8s ease-out 0.7s backwards;
}

/* ========== Buttons ========== */
.btn {
    padding: 0.85rem 1.8rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-block;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    flex: 1;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--border-color), #d1d5db);
    color: var(--text-dark);
    flex: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn-download {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    padding: 0.6rem 1.3rem;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-download:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-add {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    padding: 0.65rem 1.2rem;
    font-size: 0.95rem;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-remove {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.2);
}

.btn-remove:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* ========== Dynamic Items ========== */
.dynamic-item {
    background: linear-gradient(135deg, var(--bg-light), var(--bg-white));
    padding: 1.2rem;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    margin-bottom: 1rem;
    animation: slide-up 0.4s ease-out;
    transition: all 0.3s ease;
}

.dynamic-item:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

#educationContainer,
#projectsContainer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* ========== Preview Section ========== */
.preview-section {
    flex: 1;
    animation: slide-in-right 0.7s ease-out;
}

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

.preview-header h2 {
    font-size: 2rem;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.portfolio-preview {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-color);
    min-height: 600px;
    overflow-y: auto;
    max-height: 900px;
    transition: all 0.3s ease;
}

.portfolio-preview:hover {
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 3rem 1rem;
    font-style: italic;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ========== Portfolio Styles (Generated Content) ========== */
.portfolio {
    font-family: inherit;
    color: var(--text-dark);
}

.portfolio a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.portfolio a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Hero Section */
.portfolio-hero {
    text-align: center;
    padding: 3.5rem 0;
    border-bottom: 3px solid var(--border-color);
    margin-bottom: 2.5rem;
    position: relative;
}

.portfolio-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.08), transparent 70%);
    pointer-events: none;
}

.portfolio-hero h1 {
    font-size: 2.8rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    font-weight: 900;
    letter-spacing: -1px;
    position: relative;
    z-index: 1;
}

.portfolio-hero .role {
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    margin-bottom: 1.2rem;
    position: relative;
    z-index: 1;
}

.portfolio-hero .bio {
    font-size: 1.05rem;
    color: var(--text-light);
    max-width: 650px;
    margin: 1rem auto 0;
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

/* Section Styles */
.portfolio-section {
    margin-bottom: 2.5rem;
}

.portfolio-section h2 {
    font-size: 1.6rem;
    margin-bottom: 1.8rem;
    color: var(--text-dark);
    font-weight: 800;
    position: relative;
    padding-bottom: 1rem;
    letter-spacing: -0.5px;
}

.portfolio-section h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--primary-color));
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.portfolio-section:hover h2::after {
    width: 100%;
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.skill-badge {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(129, 140, 248, 0.08));
    border: 2px solid var(--primary-light);
    color: var(--primary-color);
    padding: 0.85rem 1.2rem;
    border-radius: 50px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.skill-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.skill-badge:hover::before {
    left: 100%;
}

.skill-badge:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

/* Experience & Education */
.experience-item,
.education-item {
    background: linear-gradient(135deg, var(--bg-light), var(--bg-white));
    padding: 1.8rem;
    border-radius: 12px;
    margin-bottom: 1.8rem;
    border-left: 5px solid var(--primary-color);
    border: 2px solid var(--border-color);
    border-left: 5px solid var(--primary-color);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.experience-item::before,
.education-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.experience-item:hover,
.education-item:hover {
    transform: translateX(6px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.15);
    border-color: var(--primary-light);
}

.experience-item:hover::before,
.education-item:hover::before {
    opacity: 1;
}

.experience-item h3,
.education-item h3 {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.experience-item p,
.education-item p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.experience-item strong {
    color: var(--primary-color);
}

/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: linear-gradient(135deg, var(--bg-light), var(--bg-white));
    padding: 1.8rem;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.project-card:hover::before {
    transform: scaleX(1);
}

.project-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.2);
    border-color: var(--primary-light);
}

.project-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.project-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.project-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(129, 140, 248, 0.1));
    border: 1px solid var(--primary-light);
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.project-link:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    transform: translateX(4px);
}

/* Contact Section */
.contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    background: linear-gradient(135deg, var(--bg-light), var(--bg-white));
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.contact-item::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.contact-item:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-color: white;
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.3);
}

.contact-item:hover::before {
    opacity: 1;
}

.contact-item:hover a {
    color: white;
}

.contact-icon {
    font-size: 1.8rem;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.2));
}

.contact-item:hover .contact-icon {
    transform: scale(1.2) rotate(5deg);
}

.contact-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.contact-item:hover .contact-label {
    color: rgba(255, 255, 255, 0.8);
}

/* Footer */
.portfolio-footer {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.9rem;
}

/* App Footer */
.app-footer {
    background: linear-gradient(135deg, var(--text-dark), #374151);
    color: white;
    text-align: center;
    padding: 2rem 1.5rem;
    margin-top: auto;
    font-size: 0.9rem;
    border-top: 2px solid var(--primary-light);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ========== Responsive Design ========== */
@media (max-width: 1024px) {
    .app-main {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    .portfolio-hero h1 {
        font-size: 2rem;
    }

    .skills-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.8rem;
    }

    .header-content p {
        font-size: 1rem;
    }

    .form-container {
        padding: 1.5rem;
    }

    .portfolio-preview {
        padding: 1.5rem;
        min-height: 400px;
    }

    .portfolio-hero h1 {
        font-size: 1.8rem;
    }

    .portfolio-hero .role {
        font-size: 1.1rem;
    }

    .portfolio-section h2 {
        font-size: 1.3rem;
    }

    .contact-info {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 2rem 1rem;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .app-main {
        padding: 1rem;
        gap: 1rem;
    }

    .form-container,
    .portfolio-preview {
        padding: 1rem;
        border-radius: 8px;
    }

    .portfolio-hero h1 {
        font-size: 1.5rem;
    }

    .portfolio-section h2 {
        font-size: 1.1rem;
    }

    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    fieldset {
        padding: 1rem 0;
    }

    legend {
        font-size: 1rem;
    }

    .portfolio-hero {
        padding: 1.5rem 0;
    }
}

/* ========== Smooth Scrolling ========== */
html {
    scroll-behavior: smooth;
}

/* ========== Print Styles ========== */
@media print {
    .app-header,
    .form-section,
    .preview-header,
    .app-footer,
    .theme-toggle,
    .btn {
        display: none !important;
    }

    .portfolio-preview {
        box-shadow: none;
        padding: 0;
    }
}
