/* ============================================
   APLIUM - Estilos Responsive & Serenos
   ============================================ */

:root {
    /* Colores APLIUM - Pau, Serenitat, Humanitat */
    --color-primary: #4CAF50;        /* Verd APLIUM */
    --color-primary-dark: #388E3C;   /* Verd fosc */
    --color-secondary: #2196F3;      /* Blau serè */
    --color-accent: #FFD54F;         /* Groc sol */
    --color-terra: #8D6E63;          /* Terra Lleida */
    --color-success: #66BB6A;        /* Verd esperança */
    --color-bg-light: #F5F5F5;       /* Gris suau */
    --color-bg-white: #FFFFFF;       /* Blanc núvol */
    --color-text-dark: #212121;      /* Text fosc */
    --color-text-light: #757575;     /* Text gris */
    --color-border: #E0E0E0;         /* Vora suau */
    
    /* Transicions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Radi */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Ombres */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);
    --shadow-xl: 0 12px 32px rgba(0,0,0,0.20);
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--color-bg-light) 0%, #E8E8E8 100%);
    color: var(--color-text-dark);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   LOADING SCREEN
   ============================================ */

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity var(--transition-slow);
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
    animation: fadeIn 0.8s ease;
}

.loading-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    font-size: 48px;
    font-weight: 700;
    animation: pulse 2s infinite;
}

.loading-logo i {
    font-size: 64px;
}

.loading-logo span {
    font-size: 48px;
    letter-spacing: -2px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 18px;
    opacity: 0.9;
    font-weight: 500;
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: opacity var(--transition-normal);
}

.container.hidden {
    opacity: 0;
}

/* ============================================
   HEADER
   ============================================ */

.app-header {
    background: var(--color-bg-white);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 24px;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.brand i {
    font-size: 32px;
    color: var(--color-primary);
}

.brand h1 {
    font-size: 28px;
    color: var(--color-text-dark);
    margin: 0;
    letter-spacing: -1px;
}

.tagline {
    font-size: 14px;
    color: var(--color-text-light);
    margin-left: 8px;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ============================================
   LANGUAGE SELECTOR
   ============================================ */

.lang-selector {
    position: relative;
}

.lang-btn {
    background: var(--color-bg-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--color-text-dark);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.lang-btn:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.lang-btn i {
    font-size: 16px;
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    border: 1px solid var(--color-border);
}

.lang-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--color-text-dark);
    transition: all var(--transition-fast);
    border-radius: var(--radius-md);
}

.lang-option:hover {
    background: var(--color-bg-light);
    color: var(--color-primary);
}

.lang-option.active {
    background: rgba(76, 175, 80, 0.1);
    color: var(--color-primary);
    font-weight: 600;
}

.lang-option .flag {
    font-size: 18px;
}

.lang-option .special-badge {
    margin-left: auto;
    color: var(--color-accent);
    font-size: 14px;
}

.lang-separator {
    height: 1px;
    background: var(--color-border);
    margin: 8px 0;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.app-main {
    flex: 1;
    padding: 32px 24px;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: var(--radius-xl);
    padding: 48px 32px;
    margin-bottom: 32px;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.6s ease-out;
}

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

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.hero h2 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.2;
}

.highlight {
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 100%);
    padding: 4px 12px;
    border-radius: var(--radius-md);
    display: inline-block;
}

.hero-subtitle {
    font-size: 18px;
    opacity: 0.95;
    margin-bottom: 32px;
    font-weight: 500;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.stat-item {
    background: rgba(255,255,255,0.15);
    padding: 20px;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 500;
}

/* ============================================
   TABS
   ============================================ */

.tabs-container {
    margin-bottom: 24px;
}

.tabs-wrapper {
    display: flex;
    gap: 8px;
    background: var(--color-bg-white);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 14px 20px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    color: var(--color-text-light);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--color-bg-light);
}

.tab-btn.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.tab-btn i {
    font-size: 18px;
}

/* ============================================
   TAB CONTENTS
   ============================================ */

.tab-contents {
    background: var(--color-bg-white);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-md);
    margin-bottom: 32px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    color: var(--color-text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.form-group i {
    color: var(--color-primary);
    font-size: 16px;
}

.form-select,
.form-input,
.form-textarea {
    padding: 14px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    transition: all var(--transition-fast);
    background: var(--color-bg-white);
}

.form-select:focus,
.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 13px;
    color: var(--color-text-light);
    font-style: italic;
    margin-top: 4px;
}

/* ============================================
   GENERATE BUTTON
   ============================================ */

.generate-section {
    text-align: center;
    margin-bottom: 40px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border: none;
    padding: 18px 48px;
    border-radius: var(--radius-full);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    letter-spacing: 0.5px;
}

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

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

.btn-generate {
    min-width: 280px;
}

/* ============================================
   RESULT SECTION
   ============================================ */

.result-section {
    animation: slideUp 0.6s ease-out;
}

.result-card {
    background: var(--color-bg-white);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-xl);
    border: 2px solid var(--color-border);
}

.result-header {
    text-align: center;
    margin-bottom: 24px;
}

.result-header h3 {
    font-size: 24px;
    color: var(--color-text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 700;
}

.result-header i {
    color: var(--color-primary);
    font-size: 28px;
}

.result-image {
    background: var(--color-bg-light);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    margin: 24px 0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--color-border);
}

.result-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.result-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-secondary {
    background: var(--color-bg-white);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    padding: 12px 32px;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.btn-secondary:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   FOOTER
   ============================================ */

.app-footer {
    background: linear-gradient(135deg, var(--color-terra) 0%, #795548 100%);
    color: white;
    padding: 32px 24px;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
}

.footer-brand i {
    color: var(--color-accent);
}

.footer-brand span {
    letter-spacing: -1px;
}

.footer-text {
    margin-bottom: 16px;
    font-size: 15px;
    opacity: 0.95;
    line-height: 1.6;
}

.footer-credits {
    opacity: 0.8;
    font-size: 13px;
}

.footer-credits a {
    color: white;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.footer-credits a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .hero h2 {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .tabs-wrapper {
        padding: 6px;
    }
    
    .tab-btn {
        min-width: 100px;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .tab-contents {
        padding: 24px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-primary {
        padding: 16px 40px;
        font-size: 17px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
    }
    
    .brand h1 {
        font-size: 24px;
    }
    
    .tagline {
        font-size: 13px;
        margin-left: 4px;
    }
    
    .hero {
        padding: 32px 20px;
    }
    
    .hero h2 {
        font-size: 28px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .stat-number {
        font-size: 24px;
    }
    
    .tabs-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-btn {
        min-width: 110px;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .tab-btn span {
        display: none;
    }
    
    .tab-btn i {
        font-size: 20px;
    }
    
    .tab-contents {
        padding: 20px;
    }
    
    .form-group label {
        font-size: 14px;
    }
    
    .form-select,
    .form-input,
    .form-textarea {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .btn-primary {
        width: 100%;
        padding: 16px;
        font-size: 16px;
        min-width: auto;
    }
    
    .result-card {
        padding: 24px 16px;
    }
    
    .result-header h3 {
        font-size: 20px;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .footer-brand {
        font-size: 24px;
    }
    
    .footer-text {
        font-size: 14px;
    }
    
    .footer-credits {
        font-size: 12px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .app-header {
        padding: 12px 16px;
    }
    
    .brand h1 {
        font-size: 22px;
    }
    
    .hero h2 {
        font-size: 24px;
    }
    
    .hero-subtitle {
        font-size: 13px;
    }
    
    .stat-item {
        padding: 16px;
    }
    
    .stat-number {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .tab-btn {
        min-width: 90px;
        padding: 8px 10px;
    }
    
    .tab-btn i {
        font-size: 18px;
    }
    
    .tab-contents {
        padding: 16px;
    }
    
    .generate-section {
        margin-bottom: 24px;
    }
    
    .result-image {
        padding: 30px 10px;
        min-height: 160px;
    }
    
    .footer-brand {
        font-size: 20px;
    }
}

/* ============================================
   ANIMATIONS & EFFECTS
   ============================================ */

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Smooth scroll for anchor links */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
*:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .app-header,
    .app-footer,
    .generate-section,
    .tabs-container {
        display: none !important;
    }
    
    .result-card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
    
    body {
        background: white !important;
    }
}
