:root {
    /* Paleta de colores - Naturaleza */
    --primary: #4caf50;
    --primary-light: #80e27e;
    --primary-dark: #087f23;
    --secondary: #795548;
    --secondary-light: #a98274;
    --secondary-dark: #4b2c20;
    --accent: #ffab00;
    --accent-light: #ffdd4b;
    --accent-dark: #c67c00;
    --background: #f9f7f1;
    --card-bg: #ffffff;
    --text: #2e2e2e;
    --text-light: #757575;
    --text-dark: #212121;
    --success: #66bb6a;
    --error: #f44336;
    
    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    
    /* Bordes */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    
    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Elementos decorativos - Hojas animadas */
.leaf-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.leaf {
    position: absolute;
    width: 100px;
    height: 100px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 24 24' fill='none' stroke='%234caf50' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 20A7 7 0 0 1 9.8 8.8L8 7V3h2v3.4l1.2 1.1A7 7 0 0 1 15 13.5v.5a7 7 0 0 1-4 6.4'/%3E%3Cpath d='M2 21c0-3 1.85-5.76 5-7'/%3E%3C/svg%3E");
    background-size: contain;
    opacity: 0.15;
    animation: floating 15s infinite linear;
}

.leaf1 {
    top: 5%;
    left: 10%;
    transform: rotate(15deg) scale(0.7);
    animation-duration: 20s;
    animation-delay: -2s;
}

.leaf2 {
    top: 15%;
    right: 5%;
    transform: rotate(-30deg) scale(1.2);
    animation-duration: 25s;
    animation-delay: -7s;
}

.leaf3 {
    bottom: 10%;
    left: 15%;
    transform: rotate(45deg) scale(0.9);
    animation-duration: 22s;
    animation-delay: -12s;
}

.leaf4 {
    bottom: 20%;
    right: 10%;
    transform: rotate(-15deg) scale(0.8);
    animation-duration: 18s;
    animation-delay: -5s;
}

.leaf5 {
    top: 50%;
    left: 50%;
    transform: rotate(60deg) scale(1.1);
    animation-duration: 30s;
    animation-delay: -15s;
}

@keyframes floating {
    0% {
        transform: translateY(0) rotate(0) scale(1);
        opacity: 0.1;
    }
    25% {
        transform: translateY(-20px) rotate(5deg) scale(1.05);
        opacity: 0.15;
    }
    50% {
        transform: translateY(-40px) rotate(10deg) scale(1.1);
        opacity: 0.2;
    }
    75% {
        transform: translateY(-60px) rotate(15deg) scale(1.05);
        opacity: 0.15;
    }
    100% {
        transform: translateY(-80px) rotate(20deg) scale(1);
        opacity: 0.1;
    }
}

/* Contenedor principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header y logo */
header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.logo-shape {
    position: relative;
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3);
    transform-style: preserve-3d;
    perspective: 500px;
    animation: rotate3d 5s infinite ease-in-out;
}

@keyframes rotate3d {
    0%, 100% { transform: rotateY(0deg); }
    50% { transform: rotateY(5deg) rotateX(5deg); }
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
    margin: 0 5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

h1 {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    position: relative;
    display: inline-block;
}

h1::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -10px;
    width: 60px;
    height: 4px;
    background: var(--accent);
    transform: translateX(-50%);
    border-radius: 2px;
}

.tagline {
    font-size: 1.2rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

/* Tarjetas */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right bottom, rgba(76, 175, 80, 0.05), rgba(76, 175, 80, 0.02));
    z-index: 0;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(76, 175, 80, 0.1);
    position: relative;
    z-index: 1;
}

.card-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0;
}

.card-body {
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Formularios e inputs */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

input[type="number"] {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1.1rem;
    border: 2px solid rgba(76, 175, 80, 0.2);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn:focus:not(:active)::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    20% {
        transform: scale(25, 25);
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

.btn-icon {
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
    width: 100%;
}

.btn-primary:hover {
    box-shadow: 0 6px 15px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(76, 175, 80, 0.1);
    color: var(--primary-dark);
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.btn-secondary:hover {
    background: rgba(76, 175, 80, 0.15);
    transform: translateY(-2px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    box-shadow: 0 4px 10px rgba(255, 171, 0, 0.3);
}

.btn-accent:hover {
    box-shadow: 0 6px 15px rgba(255, 171, 0, 0.4);
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Ejemplos */
.examples {
    margin-top: 1.5rem;
    border-top: 1px dashed rgba(76, 175, 80, 0.3);
    padding-top: 1.5rem;
}

.examples-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.pill {
    background: rgba(76, 175, 80, 0.1);
    color: var(--primary-dark);
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.pill:hover {
    background: rgba(76, 175, 80, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(76, 175, 80, 0.2);
}

/* Resultados */
.result-display {
    margin-bottom: 1.5rem;
}

.result-message {
    text-align: center;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
    color: var(--text);
    border-radius: var(--radius-sm);
    background: rgba(76, 175, 80, 0.05);
}

.result-animation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.number-container {
    flex: 1;
    min-width: 150px;
    text-align: center;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.original {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.reversed {
    background: rgba(255, 171, 0, 0.1);
    border: 1px solid rgba(255, 171, 0, 0.2);
}

.number-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--text-dark);
}

.number-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.reversed .number-value {
    color: var(--accent-dark);
}

.process-container {
    flex: 2;
    min-width: 200px;
    position: relative;
    padding: 1rem;
}

.arrow-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.arrow {
    width: 40px;
    height: 40px;
    position: relative;
}

.arrow::before {
    content: '';
    position: absolute;
    top: 50%;
    width: 30px;
    height: 2px;
    background: var(--primary);
    transform: translateY(-50%);
}

.arrow::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    border-top: 2px solid var(--primary);
    border-right: 2px solid var(--primary);
    transform: translateY(-50%) rotate(45deg);
}

.arrow-left::before {
    right: 0;
}

.arrow-left::after {
    left: 0;
    transform: translateY(-50%) rotate(225deg);
}

.arrow-right::before {
    left: 0;
}

.arrow-right::after {
    right: 0;
    transform: translateY(-50%) rotate(45deg);
}

.process-steps {
    min-height: 100px;
    border: 1px dashed rgba(76, 175, 80, 0.3);
    border-radius: var(--radius-sm);
    padding: 1rem;
    background: rgba(76, 175, 80, 0.05);
}

.step {
    margin-bottom: 0.5rem;
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    background: white;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    transform-origin: center;
    border-left: 3px solid var(--primary);
}

.step.active {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    border-left-color: var(--accent);
    background: rgba(255, 171, 0, 0.05);
}

.operation-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}

.operation-value {
    font-weight: 500;
}

.highlight {
    color: var(--primary-dark);
    font-weight: 700;
}

.comparison-container {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    background: rgba(76, 175, 80, 0.05);
    border: 1px dashed rgba(76, 175, 80, 0.3);
    text-align: center;
}

.comparison-title {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.comparison-details {
    font-size: 1.1rem;
}

.is-palindrome {
    color: var(--success);
    font-weight: 700;
}

.not-palindrome {
    color: var(--error);
    font-weight: 700;
}

.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Explicación */
.explanation {
    line-height: 1.8;
}

.explanation p {
    margin-bottom: 1rem;
}

.algorithm-overview {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: rgba(76, 175, 80, 0.05);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
}

.algorithm-overview h3 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
}

.steps-list {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.steps-list li {
    margin-bottom: 0.8rem;
}

.steps-list ul {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.complexity {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 2rem 0;
}

.complexity-item {
    flex: 1;
    min-width: 200px;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: rgba(76, 175, 80, 0.05);
    border: 1px solid rgba(76, 175, 80, 0.1);
    text-align: center;
}

.complexity-title {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.complexity-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.complexity-explanation {
    font-size: 0.85rem;
    color: var(--text);
}

.tip {
    display: flex;
    align-items: flex-start;
    padding: 1.5rem;
    background: rgba(255, 171, 0, 0.05);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent);
    margin: 1.5rem 0;
}

.tip-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
}

.tip-content {
    flex: 1;
}

.tip-content strong {
    color: var(--accent-dark);
}

.tip-content ol {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
}

/* Footer */
footer {
    margin-top: 4rem;
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid rgba(76, 175, 80, 0.1);
}

.author {
    margin-bottom: 1rem;
}

.author h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    animation: pulse 3s infinite ease-in-out;
}

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

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.social-links a {
    color: var(--primary);
    transition: all var(--transition-normal);
}

.social-links a:hover {
    color: var(--accent);
    transform: translateY(-3px) rotate(8deg);
}

.credits {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.acknowledgments {
    font-size: 0.9rem;
    color: var(--text-light);
    opacity: 0.8;
}

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

.card {
    animation: fadeInUp 0.6s ease forwards;
}

.input-section {
    animation-delay: 0.1s;
}

.result-section {
    animation-delay: 0.3s;
}

.explanation-section {
    animation-delay: 0.5s;
}

/* Media Queries */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    .result-animation {
        flex-direction: column;
    }
    
    .number-container {
        width: 100%;
    }
    
    .process-container {
        width: 100%;
        order: 3;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .controls .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }
    
    .card-header {
        flex-direction: column;
        text-align: center;
    }
    
    .card-icon {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .logo-shape {
        width: 100px;
        height: 100px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .complexity {
        flex-direction: column;
    }
}