﻿/* Estilos específicos para la página de Flutter FutureBuilder */

.tutorial-article {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.article-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #ecf0f1;
}

.article-title {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 300;
}

.article-subtitle {
    font-size: 1.2rem;
    color: #7f8c8d;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #3498db;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.content-section {
    margin-bottom: 3rem;
}

.content-section h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Overview de FutureBuilder */
.futurebuilder-overview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin: 2rem 0;
    align-items: start;
}

.states-flow {
    padding: 2rem;
    border-radius: 8px;
}

.flow-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.step-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.step-icon.waiting {
    background: #f39c12;
    color: white;
}

.step-icon.active {
    background: #3498db;
    color: white;
    animation: pulse 1.5s infinite;
}

.step-icon.done {
    background: #27ae60;
    color: white;
}

.step-icon.error {
    background: #e74c3c;
    color: white;
}

.step-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.step-arrow {
    font-size: 1.5rem;
    color: #7f8c8d;
    margin-top: -10px;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.overview-text h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.overview-text ul {
    margin: 0;
    padding-left: 1.5rem;
}

.overview-text li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Escenarios de uso */
.usage-scenarios {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.scenario {
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-top: 4px solid #3498db;
}

.scenario-icon {
    font-size: 2.5rem;
    color: #3498db;
    margin-bottom: 1rem;
}

.scenario h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

/* Propiedades */
.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.property-item {
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.property-item h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-family: monospace;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.property-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

.property-details p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

/* Estados de ConnectionState */
.connection-states {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.state-item {
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.state-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
}

.state-icon.none {
    background: #95a5a6;
    color: white;
}

.state-icon.waiting {
    background: #f39c12;
    color: white;
}

.state-icon.active {
    background: #3498db;
    color: white;
}

.state-icon.done {
    background: #27ae60;
    color: white;
}

.state-item h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.state-code {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #2c3e50;
    color: white;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
}

/* Ejemplos Visuales */
.visual-examples {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.example-item {
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.phone-mockup {
    width: 300px;
    background: #2c3e50;
    border-radius: 20px;
    padding: 15px;
    margin: 0 auto 1rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.phone-screen {
    border-radius: 10px;
    height: 500px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.futurebuilder-demo, .list-demo {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: #3498db;
    color: white;
    padding: 1rem;
    text-align: center;
}

.app-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.app-content {
    flex: 1;
    padding: 1rem;
    position: relative;
}

.loading-state, .success-state, .error-state, .initial-data, .loaded-data {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.loading-state.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.user-avatar {
    width: 80px;
    height: 80px;
    background: #3498db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin-bottom: 1rem;
}

.user-info h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.error-icon {
    font-size: 3rem;
    color: #e74c3c;
    margin-bottom: 1rem;
}

.retry-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
}

.product-item {
    padding: 1rem;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-skeleton {
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.product-skeleton:nth-child(1) { width: 70%; }
.product-skeleton:nth-child(2) { width: 50%; }
.product-skeleton:nth-child(3) { width: 60%; }

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.product-item.real i {
    color: #3498db;
    font-size: 1.2rem;
    width: 24px;
}

.state-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.state-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.state-btn:hover {
    background: #2980b9;
}

/* Demo Interactivo */
.interactive-demo {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.demo-controls {
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.demo-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.3s ease;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.demo-button:hover {
    background: #2980b9;
}

.demo-button.secondary {
    background: #95a5a6;
}

.demo-button.secondary:hover {
    background: #7f8c8d;
}

.demo-preview {
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.preview-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.phone-mockup-preview {
    width: 280px;
    background: #2c3e50;
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.phone-screen-preview {
    border-radius: 9px;
    height: 450px;
    overflow: hidden;
}

.futurebuilder-preview {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.preview-content {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.preview-header {
    text-align: center;
    margin-bottom: 2rem;
}

.preview-header h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

#previewStatus {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.preview-data {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.preview-code {
    width: 100%;
    max-width: 600px;
}

.code-output {
    background: #2c3e50;
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
}

/* Estados de preview */
.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.preview-loading .spinner {
    margin-bottom: 0;
}

.preview-success {
    background: #d5f4e6;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
}

.preview-error {
    background: #fadbd8;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
}

.preview-initial {
    background: #ebf5fb;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
}

/* Mejores Prácticas, Ejercicios, etc. */
.best-practices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.practice {
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.practice h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.practice ul {
    margin: 0;
    padding-left: 1.5rem;
}

.practice li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.pro-tip {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
    border-left: 4px solid #e17055;
}

.pro-tip h4 {
    color: #2d3436;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.exercises {
    display: grid;
    gap: 1.5rem;
    margin: 2rem 0;
}

.exercise {
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.exercise h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.exercise-hint {
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.troubleshooting-grid {
    display: grid;
    gap: 1.5rem;
    margin: 2rem 0;
}

.problem {
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.problem h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.code-solution {
    background: #2c3e50;
    color: white;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.resource {
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-top: 4px solid #3498db;
}

.resource h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.resource-link {
    display: inline-block;
    background: #3498db;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    margin-top: 1rem;
    transition: background 0.3s ease;
}

.resource-link:hover {
    background: #2980b9;
}

/* Código */
.code-example {
    margin: 2rem 0;
}

.code-example h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

pre {
    background: #2c3e50;
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

code {
    color: #e74c3c;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

pre code {
    background: none;
    color: #462f9f;
    padding: 0;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-section {
    animation: fadeIn 0.6s ease-out;
}