/* Informes Qualitatius Lite - Styles */

:root {
    --lite-primary: #818cf8;
    /* Indigo suau */
    --lite-primary-hover: #6366f1;
    --lite-accent: #f43f5e;
    /* Rose vibrant */
    --lite-gradient-start: #4f46e5;
    /* Indigo */
    --lite-gradient-end: #312e81;
    /* Dark Indigo */
    --lite-success: #10b981;
    --lite-success-hover: #059669;
    --lite-danger: #ef4444;
    --lite-danger-hover: #dc2626;
    --lite-secondary: #64748b;
    --lite-border: #e2e8f0;
    --lite-bg: #f8fafc;
    --lite-white: #ffffff;
}

#informes-lite-app {
    max-width: 1200px;
    margin: -15px auto 0 auto;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    overflow: hidden;
}

.lite-header {
    background: linear-gradient(135deg, var(--lite-gradient-start), var(--lite-gradient-end));
    color: var(--lite-white);
    padding: 10px 20px;
    text-align: center;
    border-radius: 0;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}

.lite-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%23ffffff" fill-opacity="0.1" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') bottom center no-repeat;
    background-size: cover;
    opacity: 0.2;
}

.lite-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.lite-tabs {
    display: flex;
    background: var(--lite-white);
    border-bottom: 3px solid var(--lite-primary);
    gap: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lite-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 20px;
    background: #e8e8e8;
    border: none;
    border-right: 2px solid var(--lite-white);
    cursor: pointer;
    font-size: 18px;
    /* Increased from 16px */
    font-weight: 600;
    transition: all 0.3s;
    color: #333;
}

.lite-tab svg {
    width: 20px;
    height: 20px;
    stroke-width: 2px;
    flex-shrink: 0;
}

.lite-tab:last-child {
    border-right: none;
}

.lite-tab:hover {
    background: #d0d0d0;
    color: var(--lite-primary);
}

.lite-tab.active {
    background: var(--lite-primary);
    color: var(--lite-white);
    border-bottom: 4px solid var(--lite-primary-hover);
    margin-bottom: -3px;
    box-shadow: inset 0 -3px 0 var(--lite-primary-hover);
}

/* Pestanya PRO destacada */
.lite-tab-pro {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
    color: #78350f !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.lite-tab-pro:hover {
    background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%) !important;
    color: #78350f !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.lite-tab-pro.active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #ffffff !important;
    border-bottom: 4px solid #b45309 !important;
    box-shadow: inset 0 -3px 0 #b45309, 0 4px 12px rgba(245, 158, 11, 0.5) !important;
}

.lite-content {
    background: var(--lite-white);
    padding: 15px 30px 20px 30px;
    border-radius: 0 0 8px 8px;
    min-height: 500px;
}

.lite-tab-content {
    display: none;
}

.lite-tab-content.active {
    display: block;
}

.lite-section {
    margin-bottom: 30px;
}

.lite-section h2 {
    font-size: 20px;
    margin-top: 5px;
    margin-bottom: 15px;
    color: var(--lite-secondary);
    border-bottom: 2px solid var(--lite-border);
    padding-bottom: 10px;
}

/* Buttons */
.lite-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.lite-btn-primary {
    background: var(--lite-primary);
    color: var(--lite-white);
}

.lite-btn-primary:hover {
    background: var(--lite-primary-hover);
}

.lite-btn-success {
    background: var(--lite-success);
    color: var(--lite-white);
}

.lite-btn-success:hover {
    background: var(--lite-success-hover);
}

.lite-btn-secondary {
    background: var(--lite-secondary);
    color: var(--lite-white);
}

.lite-btn-secondary:hover {
    background: #50575e;
}

.lite-btn-danger {
    background: var(--lite-danger);
    color: var(--lite-white);
}

.lite-btn-danger:hover {
    background: var(--lite-danger-hover);
}

.lite-btn-small {
    padding: 5px 12px;
    font-size: 12px;
}

/* Disabled buttons */
.lite-btn-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    background: #9ca3af !important;
    color: #ffffff !important;
}

.lite-btn-disabled:hover {
    opacity: 0.5 !important;
    background: #9ca3af !important;
    transform: none !important;
}


/* Inputs */
input[type="text"],
select {
    padding: 10px;
    border: 1px solid var(--lite-border);
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    max-width: 300px;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--lite-primary);
    box-shadow: 0 0 0 1px var(--lite-primary);
}

/* Controls */
.areas-controls,
.alumnat-controls,
.avaluacio-controls,
.informe-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

/* Àrees */
.area-item {
    background: var(--lite-bg);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid var(--lite-border);
    cursor: move;
    transition: all 0.3s;
}

.area-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--lite-primary);
}

.area-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.area-item.drag-over {
    border: 2px dashed var(--lite-primary);
    background: #e8f4f8;
}

.lite-area-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.lite-area-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--lite-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.lite-area-header h3::before {
    content: "⋮⋮";
    color: #999;
    font-size: 20px;
    cursor: move;
}

.area-collapse-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0 10px;
    color: var(--lite-secondary);
    transition: transform 0.3s;
}

.area-collapse-btn:hover {
    color: var(--lite-primary);
}

.area-collapse-btn.collapsed {
    transform: rotate(-90deg);
}

.area-content {
    max-height: 5000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.area-content.collapsed {
    max-height: 0;
}

.area-actions {
    display: flex;
    gap: 5px;
}

.item-frase {
    background: var(--lite-white);
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    border: 1px solid var(--lite-border);
}

.item-frase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.item-frase-header>div {
    display: flex;
    gap: 8px;
}

.item-frase-titol {
    font-weight: 600;
    color: var(--lite-secondary);
}

.item-frase-nivells {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    font-size: 13px;
}

.item-frase-nivells textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid var(--lite-border);
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.5;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
    background: #f9f9f9;
}

.item-frase-nivells textarea:focus {
    outline: none;
    border-color: var(--lite-primary);
    background: white;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
}

.item-frase-nivells textarea::placeholder {
    color: #999;
    font-style: italic;
}

/* Format toolbar */
.format-toolbar {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 4px;
    border: 1px solid var(--lite-border);
}

.format-btn {
    min-width: 32px;
    padding: 4px 8px !important;
    font-size: 14px !important;
    font-weight: bold;
}


/* Alumnes */
.alumne-item {
    background: var(--lite-bg);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--lite-border);
    cursor: move;
    transition: all 0.3s;
}

.alumne-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--lite-primary);
}

.alumne-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.alumne-item.drag-over {
    border: 2px dashed var(--lite-primary);
    background: #e8f4f8;
}

.alumne-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.alumne-numero {
    font-weight: bold;
    color: var(--lite-primary);
    min-width: 30px;
    font-size: 16px;
}

.alumne-nom {
    font-weight: 600;
    font-size: 16px;
}

.alumne-actions {
    display: flex;
    gap: 5px;
}

/* Avaluació */
.avaluacio-area {
    background: var(--lite-bg);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid var(--lite-border);
}

.avaluacio-area h3 {
    margin-top: 0;
    color: var(--lite-primary);
}

.avaluacio-item {
    background: var(--lite-white);
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    border: 1px solid var(--lite-border);
}

.avaluacio-item-titol {
    font-weight: 600;
    margin-bottom: 8px;
}

.avaluacio-nivells {
    display: flex;
    gap: 10px;
}

.avaluacio-nivells label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.avaluacio-nivells input[type="radio"] {
    width: auto;
}

/* Informe */
#informe-preview {
    margin-top: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--lite-border);
    border-radius: 8px;
    min-height: 200px;
    white-space: normal;
    /* Assegurar que el text fa wrap correctament */
    line-height: 1.5;
    font-family: Arial, sans-serif;
    /* Coincidir amb sortida */
    font-size: 11pt;
    /* Coincidir amb sortida */
}

#informe-preview:focus {
    border-color: var(--lite-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#informe-preview h3 {
    color: var(--lite-primary);
    margin-top: 20px;
    margin-bottom: 10px;
}

#informe-preview p {
    margin-bottom: 15px;
    text-align: justify;
}

/* Loading */
.lite-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--lite-border);
    border-top-color: var(--lite-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.config-table {
    width: 100%;
    max-width: 800px;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    border: 1px solid var(--lite-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    background: white;
}

.config-table th {
    text-align: left;
    padding: 20px 25px;
    background: #f8fafc;
    font-weight: 600;
    width: 220px;
    border-bottom: 1px solid var(--lite-border);
    color: #475569;
    font-size: 15px;
}

.config-table td {
    padding: 20px 25px;
    border-bottom: 1px solid var(--lite-border);
    background: white;
}

.config-table tr:last-child th,
.config-table tr:last-child td {
    border-bottom: none;
}

.config-table select,
.config-table input[type="password"],
.config-table input[type="text"] {
    width: 100%;
    max-width: 100%;
    padding: 12px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.2s ease;
    background-color: #f8fafc;
}

.config-table select:focus,
.config-table input:focus {
    background-color: white;
    border-color: var(--lite-primary);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
    outline: none;
}

.api-key-input {
    width: calc(100% - 50px) !important;
    display: inline-block;
    margin-right: 5px;
    -webkit-text-security: disc;
    text-security: disc;
}

.api-key-input.visible {
    -webkit-text-security: none;
    text-security: none;
}

.info-box {
    padding: 20px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid;
}

.info-box-blue {
    background: #e8f4f8;
    border-left-color: var(--lite-primary);
}

.info-box-green {
    background: #e8f8e8;
    border-left-color: #0a7e07;
}

.info-box h4 {
    margin-top: 0;
    margin-bottom: 10px;
}

.info-box ol {
    margin: 10px 0;
    padding-left: 20px;
}

.info-box li {
    margin: 8px 0;
}

.info-box a {
    color: var(--lite-primary);
    text-decoration: none;
    font-weight: 500;
}

.info-box a:hover {
    text-decoration: underline;
}

.config-info {
    border-top: 2px solid var(--lite-border);
    padding-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .lite-tabs {
        flex-direction: column;
    }

    .lite-tab {
        border-right: none;
        border-bottom: 1px solid var(--lite-border);
    }

    .item-frase-nivells {
        grid-template-columns: 1fr 1fr;
    }

    .areas-controls,
    .alumnat-controls {
        flex-direction: column;
        align-items: stretch;
    }

    input[type="text"],
    select {
        max-width: 100%;
    }
}

/* Utilitats */
.hidden {
    display: none !important;
}

/* Collapsible Note */
.lite-collapsible-note {
    background: #e8f4f8;
    border-left: 4px solid var(--lite-primary);
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
}

.lite-collapsible-note summary {
    padding: 15px 25px;
    cursor: pointer;
    font-weight: 600;
    color: var(--lite-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.lite-collapsible-note summary:hover {
    background: rgba(34, 113, 177, 0.1);
}

.lite-collapsible-note summary::after {
    content: '+';
    font-weight: bold;
    font-size: 20px;
    line-height: 1;
}

.lite-collapsible-note[open] summary::after {
    content: '-';
}

.lite-collapsible-note summary::-webkit-details-marker {
    display: none;
}

.lite-collapsible-note-content {
    padding: 10px 25px 35px 25px;
    color: #444;
    line-height: 1.6;
}


/* Danger Zone */
.lite-danger-zone {
    border: 1px solid #ffccd5;
    border-left: 4px solid #d63638;
    background: #fff;
    padding: 25px;
    border-radius: 4px;
    margin-top: 40px;
    box-shadow: 0 2px 8px rgba(214, 54, 56, 0.05);
}

.lite-danger-zone h2 {
    color: #d63638;
    border-bottom: 1px solid #ffccd5 !important;
    margin-bottom: 20px;
}


/* Data Actions Grid */
.data-actions-grid {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.data-actions-grid .lite-btn-soft {
    flex: 1;
    background: white;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 12px;
    transition: all 0.2s;
    min-width: 150px;
}

.data-actions-grid .lite-btn-soft:hover {
    border-color: #d63638;
    color: #d63638;
    background: #fff5f5;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.lite-btn-danger-link {
    width: 100%;
    margin-top: 10px;
    background: none;
    border: none;
    color: #d63638;
    text-decoration: none;
    font-weight: 600;
    padding: 15px;
    border: 1px dashed #ffaeb0;
    border-radius: 4px;
}

/* API Info Grid */
.api-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .api-info-grid {
        grid-template-columns: 1fr;
    }
}

.api-info-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--lite-border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.api-info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.api-info-card h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-info-card.card-gemini {
    border-left: 4px solid #10b981;
}

.api-info-card.card-gemini h4 {
    color: #10b981;
}

.api-info-card.card-openai {
    border-left: 4px solid #3b82f6;
}

.api-info-card.card-openai h4 {
    color: #3b82f6;
}

.api-info-card ol {
    padding-left: 20px;
    margin-bottom: 0;
}

.api-info-card li {
    margin-bottom: 8px;
    font-size: 14px;
    color: #444;
}

.lite-btn-danger-link:hover {
    background: #fff0f0;
    border-color: #d63638;
    color: #d63638;
}

/* Avaluació Compacta */
.avaluacio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 12px 15px;
    border: 1px solid var(--lite-border);
    border-radius: 6px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.avaluacio-item:hover {
    border-color: var(--lite-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.avaluacio-item-titol {
    font-weight: normal !important;
    /* Forçat a normal */
    font-size: 16px;
    /* Augmentat */
    color: #000000;
    flex: 1;
    margin-right: 20px;
}

.avaluacio-nivells {
    flex-shrink: 0;
}

/* Ajustos mida lletra Avaluació */
.avaluacio-area h3 {
    font-size: 17px;
    /* Augmentat */
    width: 100%;
    font-weight: normal !important;
    /* Forçat a normal */
    color: #000000;
    margin-bottom: 12px;
}

.avaluacio-nivells select {
    font-size: 13px;
    padding: 6px;
    color: #000;
    font-weight: normal !important;
}

/* FIX PRO VISIBILITAT */
#tab-pro.active {
    display: block !important;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}