/* ==== GENERAL STYLES & UI ==== */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #50e3c2;
    --dark-bg: #1a1a2e;
    --light-bg: #f4f7f6;
    --dark-card: #162447;
    --light-text: #e0e0e0;
    --dark-text: #333;
    --border-radius: 8px;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease-in-out;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-text);
    line-height: 1.6;
}

.app-container { display: flex; min-height: 100vh; }

/* ==== FORM STYLES ==== */
.form-container {
    width: 40%;
    padding: 40px;
    background: #ffffff;
    overflow-y: auto;
    box-shadow: 5px 0 15px rgba(0,0,0,0.05);
    max-height: 100vh;
}
.form-header { text-align: center; margin-bottom: 30px; }
.form-header h1 { font-size: 2rem; color: var(--primary-color); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 0.9rem; }
.form-group input, .form-group textarea, .form-group select, .form-entry input, .form-entry textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: 'Poppins', sans-serif;
    transition: var(--transition);
    margin-bottom: 10px;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus, .form-entry input:focus, .form-entry textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(74, 144, 226, 0.5);
}
.form-section { border: 1px solid #e0e0e0; padding: 20px; border-radius: var(--border-radius); margin-bottom: 25px; }
.form-section legend { padding: 0 10px; font-weight: 600; color: var(--primary-color); }
.form-entry { background: #fafafa; border: 1px solid #e0e0e0; padding: 15px; border-radius: var(--border-radius); margin-bottom: 15px; position: relative; }
.remove-btn { position: absolute; top: 10px; right: 10px; background: #ff4d4d; color: white; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-weight: bold; display: flex; align-items: center; justify-content: center; z-index: 10; }
.add-btn { width: 100%; padding: 10px; border: 1px dashed var(--primary-color); background: #f0f6ff; color: var(--primary-color); font-weight: 600; border-radius: var(--border-radius); cursor: pointer; transition: var(--transition); }
.add-btn:hover { background: #e2edff; }
.skill-input-group { display: flex; gap: 10px; margin-bottom: 10px; }
#skill-input { flex-grow: 1; margin-bottom: 0; }
.add-btn-small { padding: 12px 20px; border: none; background: var(--primary-color); color: white; border-radius: var(--border-radius); cursor: pointer; }
.tags-container { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tag { background: var(--primary-color); color: white; padding: 5px 12px; border-radius: 15px; display: flex; align-items: center; gap: 8px; font-size: 0.9em; }
.skill-tag .remove-tag { cursor: pointer; font-weight: bold; }
.cta-button { width: 100%; padding: 15px; border: none; border-radius: var(--border-radius); background: linear-gradient(45deg, var(--primary-color), var(--secondary-color)); color: white; font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: var(--transition); margin-top: 20px; }
.cta-button:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4); }

/* ==== PREVIEW STYLES ==== */
.preview-container { width: 60%; padding: 40px; overflow-y: auto; background: #e9eff3; max-height: 100vh; }
#portfolio-preview { background: white; box-shadow: var(--shadow); border-radius: var(--border-radius); overflow: hidden; height: 100%; transition: all 0.5s ease; }

/* ==== LIGHTBOX STYLES ==== */
.lightbox { display: none; position: fixed; z-index: 1000; padding-top: 60px; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.9); }
.lightbox-content { margin: auto; display: block; max-width: 80%; max-height: 80%; }
#lightbox-caption { text-align: center; color: #ccc; padding: 10px 0; height: 150px; }
.close-lightbox { position: absolute; top: 15px; right: 35px; color: #f1f1f1; font-size: 40px; font-weight: bold; transition: 0.3s; }
.close-lightbox:hover, .close-lightbox:focus { color: #bbb; text-decoration: none; cursor: pointer; }

/* ==== TEMPLATE BASE STYLES ==== */
.portfolio-body { padding: 4rem; animation: fadeIn 0.5s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.portfolio-header { text-align: center; margin-bottom: 4rem; display: flex; flex-direction: column; align-items: center; }
.profile-photo { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; margin-bottom: 1.5rem; }
.portfolio-header h1 { font-size: 3.5rem; margin-bottom: 0.5rem; }
.portfolio-header .bio { font-size: 1.2rem; max-width: 800px; margin: 0 auto; }
.portfolio-section { margin-bottom: 4rem; }
.section-header { text-align: center; margin-bottom: 2.5rem; }
.section-header h2 { font-size: 2.5rem; display: inline-block; position: relative; }
.section-header h2::after { content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); width: 60%; height: 4px; }
.skills-list { display: flex; flex-wrap: wrap; gap: 15px; list-style: none; padding: 0; justify-content: center; }
.skills-list li { padding: 10px 20px; border-radius: 25px; font-weight: 500; font-size: 1.1rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem; }
.card { border-radius: var(--border-radius); padding: 2rem; transition: var(--transition); }
.card h3 { margin-bottom: 0.5rem; font-size: 1.4rem; }
.card .meta { font-weight: bold; margin-bottom: 0.5rem; opacity: 0.8; }
.card .skills-gained { font-style: italic; margin-top: 1rem; }
.card .tech-used { font-style: italic; opacity: 0.8; margin-top: 1rem; }
.card a { font-weight: bold; text-decoration: none; display: inline-block; margin-top: 1rem; }
.achievements-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.achievement-item { position: relative; overflow: hidden; border-radius: var(--border-radius); cursor: pointer; }
.achievement-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.achievement-item:hover img { transform: scale(1.1); }
.achievement-item .caption { position: absolute; bottom: 0; left: 0; width: 100%; background: rgba(0,0,0,0.6); color: white; padding: 10px; text-align: center; opacity: 0; transform: translateY(100%); transition: var(--transition); }
.achievement-item:hover .caption { opacity: 1; transform: translateY(0); }
.contact-section { text-align: center; padding: 3rem; border-radius: var(--border-radius); }
.contact-section p { font-size: 1.2rem; margin-bottom: 2rem; }
.contact-links a { margin: 0 15px; font-size: 1.5rem; text-decoration: none; }

/* === TEMPLATE 1: MODERN === */
#portfolio-preview.template-modern { font-family: 'Poppins', sans-serif; color: #333; }
.template-modern .profile-photo { border: 5px solid white; box-shadow: 0 0 20px rgba(0,0,0,0.2); }
.template-modern .portfolio-header { background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); color: white; padding: 4rem 2rem; margin: -4rem -4rem 4rem -4rem; }
.template-modern .section-header h2::after { background-color: var(--primary-color); }
.template-modern .skills-list li { background-color: #eef5ff; color: var(--primary-color); }
.template-modern .card { background-color: #fff; border: 1px solid #eee; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.template-modern .card:hover { transform: translateY(-10px); box-shadow: var(--shadow); }
.template-modern .card a { color: var(--primary-color); }
.template-modern .contact-section { background: #f9f9f9; }
.template-modern .contact-links a { color: var(--primary-color); }

/* === TEMPLATE 2: MINIMAL === */
#portfolio-preview.template-minimal { font-family: 'Lato', sans-serif; color: #555; background: #fff; }
.template-minimal .profile-photo { border: 8px solid #f5f5f5; }
.template-minimal .portfolio-header h1 { font-family: 'Playfair Display', serif; font-size: 4rem; color: #111; }
.template-minimal .section-header h2 { font-family: 'Playfair Display', serif; }
.template-minimal .section-header h2::after { background-color: #ddd; }
.template-minimal .skills-list li { border: 1px solid #ddd; background-color: transparent; }
.template-minimal .card { border-bottom: 2px solid #eee; border-radius: 0; padding: 0 0 2rem 0; }
.template-minimal .card:hover { border-color: var(--dark-text); }
.template-minimal .card a { color: #333; }
.template-minimal .contact-section { background: transparent; }
.template-minimal .contact-links a { color: #333; transition: var(--transition); }
.template-minimal .contact-links a:hover { color: var(--primary-color); }

/* === TEMPLATE 3: CREATIVE === */
#portfolio-preview.template-creative { font-family: 'Montserrat', sans-serif; background-color: var(--dark-bg); color: var(--light-text); }
.template-creative .profile-photo { border: 5px solid var(--secondary-color); }
.template-creative .portfolio-header h1 { color: var(--secondary-color); text-transform: uppercase; letter-spacing: 2px; }
.template-creative .section-header h2 { color: var(--secondary-color); }
.template-creative .section-header h2::after { background: linear-gradient(90deg, var(--primary-color), var(--secondary-color)); }
.template-creative .skills-list li { background-color: var(--dark-card); color: var(--secondary-color); transition: var(--transition); border: 1px solid var(--dark-card); }
.template-creative .skills-list li:hover { background-color: var(--secondary-color); color: var(--dark-bg); transform: scale(1.1); }
.template-creative .card { background: var(--dark-card); border-left: 4px solid var(--primary-color); }
.template-creative .card:hover { transform: scale(1.03); box-shadow: 0 8px 25px rgba(80, 227, 194, 0.2); }
.template-creative .card a { color: var(--secondary-color); }
.template-creative .card .meta { color: var(--primary-color); }
.template-creative .contact-section { background: var(--dark-card); }
.template-creative .contact-links a { color: var(--secondary-color); }

/* ==== RESPONSIVENESS ==== */
@media (max-width: 1200px) {
    .app-container { flex-direction: column; }
    .form-container, .preview-container { width: 100%; max-height: none; }
}
@media (max-width: 768px) {
    .form-container, .preview-container { padding: 20px; }
    .portfolio-body { padding: 2rem; }
    .portfolio-header h1 { font-size: 2.5rem; }
    .section-header h2 { font-size: 2rem; }
}