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

:root {
    /* Colores del Colegio CEM */
    --primary-color: #1e3a5f;      /* Azul marino */
    --primary-hover: #152a45;      /* Azul marino oscuro */
    --secondary-color: #f5a623;    /* Amarillo/Dorado */
    --success-color: #2e7d32;      /* Verde */
    --error-color: #ef4444;
    --warning-color: #f5a623;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* App Container */
.app-container {
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo i {
    font-size: 2.5rem;
    color: var(--secondary-color);
}

.logo-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 50%;
    background: white;
    padding: 4px;
}

.logo h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.tab-btn.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.tab-btn i {
    font-size: 0.9rem;
}

/* Tab Content */
.tab-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Input Section */
.input-section {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.input-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-weight: 600;
}

.input-header i {
    color: var(--primary-color);
}

#texto {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

#texto:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(30 58 95 / 0.2);
    background: var(--bg-primary);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.char-counter {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: var(--error-color);
    color: white;
}

/* Translate Section */
.translate-section {
    display: flex;
    justify-content: center;
}

.translate-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    min-width: 160px;
    justify-content: center;
}

.translate-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.translate-btn:active {
    transform: translateY(0);
}

.translate-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

/* Result Section */
.result-section {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-weight: 600;
}

.result-header i {
    color: var(--success-color);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Result Content */
.result-content {
min-height: 80px;
padding: 20px;
background: var(--bg-secondary);
border-radius: var(--radius-sm);
border: 2px dashed var(--border-color);
font-size: 1.2rem;
line-height: 1.5;
}

.result-content.has-result {
background: var(--bg-primary);
border: 2px solid var(--success-color);
color: var(--text-primary);
font-weight: 500;
}

/* Translation Text Styling */
.translation-text {
color: var(--text-primary) !important;
font-size: 1.3rem !important;
font-weight: 600 !important;
line-height: 1.4 !important;
text-align: center !important;
padding: 10px !important;
background: var(--bg-primary) !important;
border-radius: var(--radius-sm) !important;
margin: 0 !important;
display: block !important;
visibility: visible !important;
opacity: 1 !important;
}

.placeholder {
text-align: center;
color: var(--text-secondary);
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.placeholder i {
    font-size: 2rem;
    opacity: 0.5;
}

/* Method Indicator */
.method-indicator {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
}

.method-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.method-badge i {
    width: 20px;
    color: var(--primary-color);
}

.method-badge span {
    font-weight: 600;
    color: var(--text-primary);
}

.method-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-left: 28px;
}

/* Method Colors */
.method-dictionary {
    border-left-color: var(--success-color);
}

.method-dictionary .method-badge i {
    color: var(--success-color);
}

.method-structure {
    border-left-color: var(--warning-color);
}

.method-structure .method-badge i {
    color: var(--warning-color);
}

.method-ai {
    border-left-color: var(--secondary-color);
}

.method-ai .method-badge i {
    color: var(--secondary-color);
}

/* Error Section */
.error-section {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 24px;
}

.error-content {
    text-align: center;
    color: var(--error-color);
}

.error-content i {
    font-size: 3rem;
    margin-bottom: 16px;
}

.error-content h3 {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.retry-btn {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    transition: all 0.2s ease;
}

.retry-btn:hover {
    background: #dc2626;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.action-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.action-btn i {
    font-size: 0.8rem;
}

/* Examples Section */
.examples-section h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.example-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.example-spanish {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.example-kaqchikel {
    color: var(--primary-color);
    font-style: italic;
    margin-bottom: 8px;
}

.example-type {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
}

/* History Section */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-header h3 {
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-history-btn {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.clear-history-btn:hover {
    background: #dc2626;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.history-empty i {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.history-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: var(--primary-color);
}

.history-spanish {
    font-weight: 600;
    margin-bottom: 4px;
}

.history-kaqchikel {
    color: var(--primary-color);
    font-style: italic;
    margin-bottom: 8px;
}

.history-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* Culture Section */
.culture-section h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.culture-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.culture-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 20px;
}

.culture-card h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.culture-card h4 i {
    color: var(--primary-color);
}

.culture-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.footer span {
    font-weight: 600;
    color: var(--secondary-color);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.licenses {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 16px;
    backdrop-filter: blur(10px);
}

.licenses h4 {
    margin-bottom: 12px;
    color: white;
    font-size: 0.9rem;
}

.licenses ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.licenses li {
    margin-bottom: 8px;
    font-size: 0.8rem;
    line-height: 1.4;
}

.licenses a {
    color: var(--secondary-color);
    text-decoration: none;
}

.licenses a:hover {
    text-decoration: underline;
}

.admin-link {
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
    text-decoration: none;
    transition: color 0.3s;
}

.admin-link:hover {
    color: rgba(255, 255, 255, 0.7);
}

.footer-content {
    position: relative;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 16px;
    }
    
    .logo h1 {
        font-size: 1.8rem;
    }
    
    .input-section,
    .result-section,
    .tab-content {
        padding: 20px;
    }
    
    .translate-btn {
        padding: 14px 28px;
        font-size: 1rem;
    }
    
    #texto {
        min-height: 100px;
    }
    
    .tab-btn span {
        display: none;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        justify-content: center;
    }
    
    .history-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .footer-content {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 12px;
    }
    
    .main-content {
        gap: 20px;
    }
    
    .input-section,
    .result-section,
    .tab-content {
        padding: 16px;
    }
    
    .logo {
        flex-direction: column;
        gap: 8px;
    }
    
    .logo h1 {
        font-size: 1.6rem;
    }
    
    .nav-tabs {
        padding: 2px;
    }
    
    .tab-btn {
        padding: 10px 8px;
    }
    
    .culture-content {
        gap: 12px;
    }
    
    .culture-card {
        padding: 16px;
    }
}