/* Variables CSS */
:root {
    --primary-color: #FF6B35;
    --secondary-color: #004E89;
    --background-color: #F7F7F7;
    --surface-color: #FFFFFF;
    --text-primary: #1A1A2E;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --success-color: #10B981;
    --error-color: #EF4444;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

/* Reset y base */
.uniminuto-app-container * {
    box-sizing: border-box;
}

.uniminuto-app-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    background: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Header */
.app-header {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    padding-top: max(1rem, env(safe-area-inset-top));
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-title-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

.app-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.app-logo {
    height: 40px;
    max-width: 200px;
    object-fit: contain;
}

.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 1.25rem;
    margin: 0 0.5rem;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

.connection-indicator {
    display: flex;
    align-items: center;
}

.online-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

.online-dot.offline {
    background: var(--error-color);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main Content */
.app-main {
    flex: 1;
    padding: 1rem;
    padding-bottom: 80px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.app-section {
    display: none;
}

.app-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.75rem;
    margin: 0;
    color: var(--text-primary);
}

/* News Grid */
.news-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.news-card {
    background: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.news-card:active {
    transform: scale(0.98);
}

.news-card:hover {
    box-shadow: var(--shadow-lg);
}

.news-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--border-color);
}

.news-card-content {
    padding: 1.25rem;
}

.news-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
    line-height: 1.4;
}

.news-card-excerpt {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1rem 0;
}

.news-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.news-card-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-card-categories {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.category-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 3rem 1rem;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Buttons */
.btn-load-more {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 2rem auto;
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-load-more:hover {
    background: var(--secondary-color);
}

.btn-load-more:active {
    transform: scale(0.98);
}

/* Bottom Navigation */
.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: color 0.3s;
    flex: 1;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 1.5rem;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 500;
}

/* News Modal */
.news-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.news-modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: var(--surface-color);
    width: 100%;
    max-width: 800px;
    margin: 2rem;
    border-radius: 12px;
    position: relative;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-body {
    padding: 2rem;
}

.modal-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 2rem;
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.modal-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modal-content-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.modal-content-body p {
    margin-bottom: 1rem;
}

.modal-content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

/* About Section */
.about-content {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.about-logo img {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.about-content h3 {
    font-size: 1.75rem;
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.install-pwa-section,
.ios-install-instructions {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--background-color);
    border-radius: 8px;
}

.install-pwa-section h4,
.ios-install-instructions h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.btn-install {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
}

.ios-install-instructions ol {
    text-align: left;
    margin: 0;
    padding-left: 1.5rem;
}

.ios-install-instructions li {
    margin-bottom: 0.5rem;
}

.ios-share-icon {
    font-size: 1.2rem;
}

.app-info {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Offline Message */
.offline-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface-color);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.offline-content {
    text-align: center;
    max-width: 400px;
}

.offline-content img {
    width: 150px;
    height: 150px;
    margin-bottom: 2rem;
}

.offline-content h3 {
    font-size: 1.75rem;
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.offline-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.btn-retry {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

/* Responsive ajustes */
@media (min-width: 640px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .uniminuto-app-container {
        max-width: 1200px;
    }
    
    .news-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Light Theme (default) */
body.light-theme {
    --secondary-color: #004E89;
    --background-color: #F7F7F7;
    --surface-color: #FFFFFF;
    --text-primary: #1A1A2E;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --success-color: #10B981;
    --error-color: #EF4444;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

/* Dark Theme */
body.dark-theme {
    --secondary-color: #004E89;
    --background-color: #1A1A2E;
    --surface-color: #16213E;
    --text-primary: #F7F7F7;
    --text-secondary: #9CA3AF;
    --border-color: #2D3748;
    --success-color: #10B981;
    --error-color: #EF4444;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
}

