@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2c3e50; /* Gris azulado oscuro (Corporate) */
    --secondary-color: #3498db; /* Azul brillante (Accent) */
    --accent-color-vibrant: #2980b9;
    --background-color: #ffffff;
    --light-gray-bg: #f7f9fb;
    --text-color: #555;
    --heading-color: #2c3e50;
    --light-text-color: #ffffff;
    --border-color: #ecf0f1;
    --error-color: #e74c3c;
    --card-shadow: 0 20px 40px rgba(0,0,0,0.08);
    --header-shadow: 0 2px 15px rgba(0,0,0,0.06);
}

body.dark-mode {
    --primary-color: #ecf0f1; /* Blanco roto */
    --secondary-color: #3498db; /* Se mantiene el azul */
    --accent-color-vibrant: #5dade2;
    --background-color: #1c2833;
    --light-gray-bg: #212f3c;
    --text-color: #bdc3c7;
    --heading-color: #ffffff;
    --border-color: #34495e;
    --card-shadow: 0 20px 40px rgba(0,0,0,0.2);
    --header-shadow: 0 2px 15px rgba(0,0,0,0.2);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container { width: 90%; max-width: 1140px; margin: 0 auto; }

/* --- Header --- */
.main-header { 
    background: var(--background-color);
    padding: 1.2rem 0;
    box-shadow: var(--header-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}
.main-header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.7rem; font-weight: 700; color: var(--heading-color); text-decoration: none; }
nav ul { list-style: none; display: flex; align-items: center; gap: 2.5rem; }
nav a { text-decoration: none; color: var(--text-color); font-weight: 500; transition: color 0.3s; }
nav a:hover { color: var(--secondary-color); }

/* --- Botones --- */
.btn { 
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.btn-primary { background-color: var(--secondary-color); color: var(--light-text-color); }
.btn-primary:hover { background-color: var(--accent-color-vibrant); transform: translateY(-3px); box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4); }
.btn-secondary { background-color: transparent; color: var(--light-text-color); border-color: var(--light-text-color); }
.btn-secondary:hover { background-color: var(--light-text-color); color: var(--secondary-color); }

/* --- Hero Section --- */
.hero { 
    background: linear-gradient(rgba(44, 62, 80, 0.85), rgba(44, 62, 80, 0.85)), url('https://images.unsplash.com/photo-1556740738-b6a63e27c4df?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80') no-repeat center center/cover;
    color: var(--light-text-color);
    text-align: center;
    padding: 8rem 0;
}
.hero h1 { font-size: 3.8rem; font-weight: 700; margin-bottom: 1.5rem; line-height: 1.2; }
.hero .subtitle { font-size: 1.2rem; max-width: 750px; margin: 0 auto 2.5rem; opacity: 0.9; }

/* --- Secciones Generales --- */
section { padding: 6rem 0; transition: background-color 0.3s ease; }
section h2 { text-align: center; font-size: 2.8rem; font-weight: 600; color: var(--heading-color); margin-bottom: 1rem; }
.section-subtitle { text-align: center; font-size: 1.1rem; color: #777; max-width: 600px; margin: 0 auto 4rem; }
body.dark-mode .section-subtitle { color: #95a5a6; }

/* --- Services Section --- */
.services-section { background-color: var(--light-gray-bg); }
.services-grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 2rem; }
.service-card { 
    background: var(--background-color);
    padding: 2.5rem 2rem;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s, border-color 0.3s;
}
.service-card:hover { transform: translateY(-10px); box-shadow: var(--card-shadow); }
.service-card i { font-size: 2.5rem; color: var(--secondary-color); margin-bottom: 1.5rem; line-height: 1; }
.service-card h3 { font-size: 1.4rem; color: var(--heading-color); margin-bottom: 1rem; }

/* --- How It Works Section --- */
.steps-container { display: flex; justify-content: space-around; align-items: flex-start; gap: 2rem; margin-top: 4rem; }
.step { text-align: center; flex: 1; max-width: 300px; }
.step-number { 
    width: 50px; height: 50px; line-height: 50px;
    border-radius: 50%; border: 2px solid var(--secondary-color);
    color: var(--secondary-color); font-size: 1.5rem; font-weight: 600;
    margin: 0 auto 1.5rem;
}
.step-arrow { display: none; } 

/* --- CTA Section --- */
.cta-section { background-color: #2c3e50; color: var(--light-text-color); text-align: center; }
body.dark-mode .cta-section { background-color: #1B2631; }
.cta-section h2 { color: var(--light-text-color); }
.cta-section p { max-width: 600px; margin: 0 auto 2.5rem; opacity: 0.9; }

/* --- Footer --- */
.main-footer { background-color: var(--heading-color); color: #aab2bb; text-align: center; padding: 3rem 0; }
.main-footer a { color: var(--light-text-color); text-decoration: none; transition: color 0.3s; }
.main-footer a:hover { color: var(--secondary-color); }

/* --- Login Page --- */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: var(--light-gray-bg); position: relative; }
.login-box { 
    background: var(--background-color);
    padding: 3rem;
    border-radius: 12px; 
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    width: 100%; max-width: 420px; text-align: center;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.login-box h2 { color: var(--heading-color); margin-bottom: 1rem; }
.back-to-home { display: inline-block; margin-bottom: 2rem; text-decoration: none; color: var(--secondary-color); font-weight: 500; }
.error-message { color: var(--error-color); background-color: #fdeded; padding: 0.8rem; border-radius: 8px; margin-bottom: 1.5rem; }
body.dark-mode .error-message { background-color: #4a2c2c; }
.input-group { position: relative; margin-bottom: 1.5rem; }
.input-group i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #ccc; }
.input-group input { 
    width: 100%; 
    padding: 14px 14px 14px 50px; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    font-size: 1rem; 
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
    background-color: var(--background-color);
    color: var(--text-color);
}
.input-group input:focus { border-color: var(--secondary-color); outline: none; }
.login-box .btn { width: 100%; padding: 14px; background-color: var(--secondary-color); font-size: 1.1rem; }
.login-box .btn:hover { background-color: var(--accent-color-vibrant); }

/* --- Theme Switcher --- */
#theme-switcher {
    background: var(--light-gray-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    flex-shrink: 0; /* Evita que se encoja */
}
#theme-switcher:hover { transform: scale(1.1); background-color: var(--border-color); }

.login-box #theme-switcher {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
}

.main-header #theme-switcher { margin-left: 1.5rem; }

/* --- App Page --- */
.app-container { position: relative; max-width: 1400px; margin: 2rem auto; padding: 0; background: transparent; border-radius: 12px; box-shadow: none; border: none; }
.app-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding: 1.2rem 2rem; margin-bottom: 0; background-color: var(--background-color); border-top-left-radius: 12px; border-top-right-radius: 12px; }
.header-actions { display: flex; align-items: center; gap: 1.5rem; }
.app-header h1 { color: var(--heading-color); font-size: 1.5rem; }
.logout-btn { text-decoration: none; color: var(--secondary-color); font-weight: 600; }

.app-layout { display: grid; grid-template-columns: 350px 1fr; min-height: 75vh; background-color: var(--light-gray-bg); border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; overflow: hidden; }

.control-panel { background-color: var(--background-color); padding: 2rem; border-right: 1px solid var(--border-color); transition: all 0.3s ease; }
.control-panel h3 { font-size: 1.2rem; margin-bottom: 0.5rem; color: var(--heading-color); }
.control-panel p { font-size: 0.9rem; margin-bottom: 2rem; color: var(--text-color); }

.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--heading-color); }
.help-icon { color: var(--secondary-color); cursor: pointer; font-size: 0.9rem; margin-left: 0.5rem; transition: color 0.3s; }
.help-icon:hover { color: var(--primary-color); }
.form-group textarea, .form-group select { width: 100%; padding: 0.8rem; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem; background-color: var(--light-gray-bg); color: var(--text-color); transition: all 0.3s ease; }
.form-group textarea:focus, .form-group select:focus { border-color: var(--secondary-color); outline: none; background-color: var(--background-color); }

.generate-btn { width: 100%; padding: 1rem; font-size: 1.1rem; display: flex; justify-content: center; align-items: center; gap: 0.5rem; }
.generate-btn:disabled { background-color: var(--text-color); cursor: not-allowed; transform: none; box-shadow: none; }
.generate-btn:disabled .fa-spinner { animation: spin 1s linear infinite; }

.results-panel { padding: 2rem 3rem 3rem; display: flex; flex-direction: column; align-items: center; text-align: center; }

.service-selector { display: flex; gap: 1rem; margin-bottom: 2rem; background-color: var(--background-color); padding: 0.5rem; border-radius: 10px; border: 1px solid var(--border-color); }
.service-btn { background: transparent; border: none; padding: 0.8rem 1.5rem; border-radius: 8px; font-size: 0.9rem; font-weight: 600; color: var(--text-color); cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; gap: 0.5rem; }
.service-btn.active { background-color: var(--secondary-color); color: var(--light-text-color); }
.service-btn:not(.active):hover { background-color: var(--light-gray-bg); }

#results-initial-state, #results-loading-state { color: var(--text-color); }
#results-initial-state i, #results-loading-state i { font-size: 4rem; color: var(--secondary-color); opacity: 0.5; margin-bottom: 1.5rem; }
#results-initial-state h2, #results-loading-state h3 { font-size: 1.8rem; color: var(--heading-color); margin-bottom: 1rem; }
#results-initial-state p, #results-loading-state p { max-width: 400px; }

.loader { width: 50px; height: 50px; border: 5px solid var(--border-color); border-top-color: var(--secondary-color); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 1.5rem; }
@keyframes spin { to { transform: rotate(360deg); } }

#results-output-state { width: 100%; height: 100%; display: none; flex-direction: column; text-align: left; }
.results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
.results-header h3 { color: var(--heading-color); font-size: 1.2rem; display: flex; align-items: center; gap: 0.5rem; }
.results-header h3 i { color: #27ae60; }

.btn-copy { background: var(--light-gray-bg); border: 1px solid var(--border-color); color: var(--text-color); padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer; transition: all 0.3s; }
.btn-copy:hover { background: var(--border-color); }

.output-content-wrapper { flex-grow: 1; background-color: var(--background-color); padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border-color); overflow-y: auto; white-space: pre-wrap; line-height: 1.8; font-family: 'Menlo', 'Monaco', monospace; font-size: 0.95rem; }

/* --- Modal de Ayuda --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 2000; backdrop-filter: blur(5px); opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.modal-overlay.visible { opacity: 1; visibility: visible; }
.modal-content { background: var(--background-color); color: var(--text-color); padding: 2.5rem; border-radius: 12px; max-width: 600px; width: 90%; box-shadow: 0 10px 30px rgba(0,0,0,0.2); position: relative; border: 1px solid var(--border-color); transform: scale(0.95); transition: transform 0.3s ease;}
.modal-overlay.visible .modal-content { transform: scale(1); }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; font-size: 2rem; color: var(--text-color); cursor: pointer; line-height: 1; opacity: 0.7; transition: opacity 0.3s; }
.modal-close:hover { opacity: 1; }
.modal-content h3 { margin-top: 0; color: var(--heading-color); display: flex; align-items: center; gap: 0.75rem; }
.modal-content h3 .fas { color: var(--secondary-color); }
.modal-content ul { list-style: none; padding-left: 0; }
.modal-content li { background-color: var(--light-gray-bg); padding: 0.8rem; border-radius: 6px; margin-bottom: 0.5rem; border-left: 3px solid var(--secondary-color); }
.modal-content strong { color: var(--heading-color); }

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

@media (max-width: 992px) {
    .hero h1 { font-size: 3rem; }
    section h2 { font-size: 2.2rem; }
    .services-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    body { font-size: 15px; }
    .main-header .container { flex-direction: column; gap: 1rem; }
    nav ul { padding-top: 1rem; gap: 1.5rem; }
    .hero { padding: 6rem 0; }
    .hero h1 { font-size: 2.5rem; }
    .steps-container { flex-direction: column; gap: 3rem; }
    .services-grid { grid-template-columns: 1fr; }
}
