/* ── Student page standalone styles ─────────────────────────────────────── */

/* Reset mínim per standalone (fora de WordPress) */
.student-body {
    margin: 0;
    padding: 0;
    background: hsl(240, 20%, 97%);
    font-family: 'Inter', sans-serif;
    color: hsl(240, 20%, 15%);
    min-height: 100vh;
}

/* Wrapper principal */
.student-wrapper {
    --c-primary: #059669;
    --c-secondary: #0d9488;
    --c-primary-glow: rgba(5, 150, 105, 0.25);
    --hue-primary: 160;
    --c-bg: hsl(240, 20%, 97%);
    --c-surface-border: hsla(0, 0%, 0%, 0.08);
    --c-text: hsl(240, 20%, 15%);
    --c-text-muted: hsl(240, 10%, 45%);
    --c-danger: hsl(350, 70%, 55%);

    margin: 0 auto 40px auto;
    padding: 30px 3vw 50px 3vw;
    width: 100%;
    max-width: 1300px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    border-radius: 20px;
    border-radius: 20px;
    background-color: #10b981;
    background-image: linear-gradient(135deg, #10b981, #0284c7);
    /* Verd intens fins a blau cian */
    box-sizing: border-box;
}

.student-wrapper * {
    box-sizing: border-box;
}

.student-wrapper .bg-shapes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
}

/* ── Header ── */
.student-header {
    width: 100%;
    text-align: left;
    padding: 2rem !important;
    margin-bottom: 0 !important;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.student-header .app-title {
    background: linear-gradient(135deg, #6ee7b7, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 0.75rem 0;
}

/* La icona del làpis ha de ser sempre visible */
.student-header .app-title i,
.student-header .app-title .fa-pencil {
    -webkit-text-fill-color: initial !important;
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    color: #34d399 !important;
    font-size: 1.9rem;
}

/* Badges grans de tipus i curs */
.student-meta-destacada {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.meta-badge-gran {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 50px;
    padding: 0.45rem 1.1rem;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.badge-tipus {
    background: rgba(5, 150, 105, 0.12);
    color: #065f46;
    border: 1.5px solid rgba(5, 150, 105, 0.35);
}

.badge-curs {
    background: rgba(13, 148, 136, 0.12);
    color: #134e4a;
    border: 1.5px solid rgba(13, 148, 136, 0.35);
}

.student-nom-mestre {
    font-size: 0.95rem;
    font-weight: 500;
    color: #065f46;
    margin: 0 0 0.2rem 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    opacity: 0.85;
}

/* ── Títol principal gran ── */
.student-app-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    color: #065f46;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.6rem;
    margin: 0 auto 1rem auto;
    line-height: 1.1;
}

.student-app-title i {
    color: #059669;
    font-size: 2rem;
    flex-shrink: 0;
}

/* ── Banner destacat del tipus de text ── */
.student-tipus-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    background: linear-gradient(135deg, #0ea5e9, #059669);
    /* Combina blau i verd per ressaltar */
    border: 2px solid #38bdf8;
    border-radius: 14px;
    padding: 0.7rem 1.4rem;
    margin: 0 auto 1rem auto;
    align-self: center;
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.25);
}

.student-tipus-icon {
    color: #e0f2fe;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.student-tipus-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

/* ── Fila meta (curs + mestre) ── */
.student-meta-fila {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    /* Augmentat perquè destaqui més que els badges inferiors */
    color: hsl(240, 15%, 25%);
    font-weight: 500;
    margin: 0 auto 0.4rem auto;
    align-self: center;
}

.student-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.student-meta-item i {
    color: #059669;
    font-size: 1.1rem;
    /* Icona també més gran */
}

.student-meta-sep {
    color: hsl(240, 10%, 65%);
    font-size: 1.1rem;
    line-height: 1;
}

/* ── Panell de criteris ── */
.criteria-info-panel {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.06), rgba(13, 148, 136, 0.04));
    border: 1px solid rgba(5, 150, 105, 0.20);
    border-left: 4px solid #059669;
    border-radius: 14px;
    overflow: hidden;
}

.criteria-info-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1rem 1.4rem;
    font-weight: 800;
    font-size: 1.25rem;
    color: #059669;
    font-family: 'Outfit', sans-serif;
    border-bottom: 1px solid rgba(5, 150, 105, 0.12);
}

.criteria-info-header i {
    font-size: 1.15rem;
    color: #34d399;
}

.criteria-info-body {
    padding: 0 1.25rem 1.25rem;
}

.descripcio-box {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: hsl(240, 20%, 20%);
    margin-bottom: 1rem;
    line-height: 1.6;
    border: 1px solid rgba(5, 150, 105, 0.12);
}

.criteria-list-student {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.criteria-list-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: box-shadow 0.2s;
}

.criteria-list-item:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.09);
}

.criteria-list-nom {
    font-size: 0.95rem;
    color: hsl(240, 20%, 12%);
    font-weight: 700;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 0;
}

.criteria-list-nom i {
    display: none;
}

.criteria-list-exp {
    font-size: 0.87rem;
    color: #6b7280;
    line-height: 1.55;
}

@media (max-width: 640px) {
    .criteria-list-student {
        grid-template-columns: 1fr;
    }
}

.criteria-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 20px;
    padding: 0.45rem 1rem;
    font-size: 0.95rem;
    /* Restablert per mantenir harmonia amb el panell i quedar més petit que curs/mestre */
    font-weight: 600;
}

.badge-blue {
    background: rgba(5, 150, 105, 0.10);
    color: #065f46;
    border: 1px solid rgba(5, 150, 105, 0.25);
}

.badge-feedback {
    background: rgba(5, 150, 105, 0.08);
    color: #065f46;
    border: 1px solid rgba(5, 150, 105, 0.20);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.badge-purple {
    background: rgba(109, 40, 217, 0.08);
    color: #6d28d9;
    border: 1px solid rgba(109, 40, 217, 0.2);
}

/* ── Main (formulari + resultats) ── */
.student-main {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    z-index: 1;
    padding: 2rem 0 0 0;
}

.student-form-panel,
.student-results-panel {
    width: 100% !important;
    max-width: 100% !important;
}

/* ── Textarea ── */
.student-textarea {
    width: 100%;
    min-height: 18rem;
    resize: vertical;
    border: 2px dashed var(--c-surface-border) !important;
    border-radius: 16px !important;
    background: rgba(0, 0, 0, 0.01) !important;
    transition: all 0.3s ease !important;
    font-size: 1rem !important;
    line-height: 1.6 !important;
    padding: 1rem !important;
}

.student-textarea:hover,
.student-textarea:focus {
    border-color: #059669 !important;
    background: rgba(5, 150, 105, 0.05) !important;
    outline: none !important;
}

.student-textarea:focus {
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25) !important;
}

.textarea-wrapper {
    position: relative;
}

/* ── Comptador de paraules ── */
.word-counter {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--c-text-muted);
    margin-top: 0.4rem;
    padding-right: 0.25rem;
    transition: color 0.3s;
}

.word-counter .word-min {
    opacity: 0.7;
}

.word-counter--ok #wordCount,
.word-counter--ok {
    color: #16a34a;
    font-weight: 600;
}

.word-counter--warn #wordCount,
.word-counter--warn {
    color: #059669;
    font-weight: 600;
}

/* Botó esborrar text */
.student-wrapper .btn-clear-text {
    margin-top: 0.4rem;
    padding: 0.4rem 0.9rem;
    background: transparent;
    border: 1px solid var(--c-surface-border);
    border-radius: 8px;
    color: var(--c-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    align-self: flex-end;
}

.student-wrapper .btn-clear-text:hover {
    background: rgba(255, 100, 100, 0.1);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* ── Error card ── */
.student-error-card {
    position: relative;
    z-index: 1;
    background: white;
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    width: 100%;
    max-width: 500px;
    margin-top: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.student-error-card i {
    font-size: 3rem;
    color: #f59e0b;
    margin-bottom: 1rem;
}

.student-error-card h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    margin: 0 0 0.75rem 0;
    color: hsl(240, 20%, 15%);
}

/* ── Estils del camp d'explicació editable (pàgina mestra) ── */
.criterion-item-wrapper {
    margin-bottom: 0.5rem;
    border: 1px solid var(--c-surface-border);
    border-radius: 12px;
    padding: 0.6rem 0.75rem 0.75rem;
    background: rgba(255, 255, 255, 0.5);
    transition: border-color 0.2s;
}

.criterion-item-wrapper:hover {
    border-color: var(--c-primary);
}

.criterion-item-wrapper .checkbox-item {
    margin-bottom: 0;
}

.criterion-exp-row {
    margin-top: 0.45rem;
    padding-left: 2rem;
}

.criterion-exp-input {
    width: 100%;
    font-size: 0.85rem !important;
    padding: 0.4rem 0.75rem !important;
    border-radius: 8px !important;
    border: 1px solid rgba(5, 150, 105, 0.2) !important;
    background: rgba(5, 150, 105, 0.03) !important;
    color: hsl(240, 20%, 30%) !important;
    transition: border-color 0.2s !important;
}

.criterion-exp-input:focus {
    border-color: var(--c-primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 2px var(--c-primary-glow) !important;
}

.criterion-exp-input::placeholder {
    color: hsl(240, 10%, 65%) !important;
    font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .student-wrapper {
        padding: 15px 12px 30px 12px;
        border-radius: 0;
        margin: 0;
    }

    .student-tipus-nom {
        font-size: 1.8rem;
    }

    .criteria-chips-row {
        gap: 0.35rem;
    }
}

/* ── Panell de link de sessió (pàgina docent) ── */
.session-link-panel {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.08), rgba(5, 150, 105, 0.05));
    border: 1px solid rgba(22, 163, 74, 0.3);
    border-left: 4px solid #16a34a;
    border-radius: 14px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.session-link-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #15803d;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.session-link-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(22, 163, 74, 0.25);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    word-break: break-all;
}

.session-link-box a {
    flex: 1;
    color: #059669;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
}

.session-link-box a:hover {
    text-decoration: underline;
}

.btn-copy-link {
    background: #16a34a;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-copy-link:hover {
    background: #15803d;
}

.session-link-note {
    font-size: 0.88rem;
    color: #166534;
    opacity: 0.85;
}