/* ─────────────────────────────────────────────
   0. VARIABLES I BASE GLOBAL
   ───────────────────────────────────────────── */

:root {
    --black: #000000;
    --gold: #926F25;
    --gold-dark: #6D531B;
    --gold-light: #B29A66;
    --white: #FFFFFF;
    --grey-light: #F4F4F4;
    --grey-text: #666666;
    --green-ok: #2E7D32;
    --red-error: #C62828;

    /* Paleta per al dashboard i menú */
    --brand-primary: var(--gold);
    --brand-secondary: #0066cc;
    --brand-accent: #00a676;
    --brand-muted: #7b4bb7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--grey-light);
    color: var(--black);
}

/* ─────────────────────────────────────────────
   1. LAYOUT GENERAL (HEADER, MAIN)
   ───────────────────────────────────────────── */

.app-header {
    background: var(--black);
    color: var(--white);
    padding: 0.75rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* Logo DOMENJÓ (capçalera) */
.app-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    box-shadow: 0 0 0 1px #333;
}

.app-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.app-brand {
    display: flex;
    flex-direction: column;
}

.app-brand-name {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.app-brand-sub {
    font-size: 0.75rem;
    color: #cccccc;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.85rem;
}

.app-header-client {
    white-space: nowrap;
}

.app-header-logout {
    margin: 0;
}

.app-client-name {
    color: var(--gold-light);
}

/* Botó “Tancar sessió” */
.btn-logout {
    border-radius: 999px;
    border: 1px solid #444;
    background: transparent;
    color: var(--white);
    padding: 0.35rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-logout:hover {
    background: #222;
}

/* Cos de la pàgina */
.app-main {
    padding: 1.75rem;
}

/* Responsiu header en mòbil */
@media (max-width: 640px) {
    .app-header-right {
        gap: 0.4rem;
    }

    .app-header-client {
        display: none; /* si vols més espai a mòbil */
    }

    .btn-logout {
        padding-inline: 0.7rem;
    }
}

/* ─────────────────────────────────────────────
   2. MENÚ LATERAL (NAV)
   ───────────────────────────────────────────── */

/* Botó hamburger */
.app-menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid #444;
    background: #111;
    cursor: pointer;
    padding: 0;
}

.app-menu-toggle span {
    display: block;
    width: 16px;
    height: 2px;
    margin: 0 auto;
    background: #fff;
    border-radius: 999px;
}

/* Overlay fosc quan el menú és obert */
.app-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 30;
}

/* Panell lateral (menú) */
.app-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: min(280px, 80vw);
    height: 100vh;
    background: #111;
    color: #fff;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 40;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.25rem 1.5rem;
}

.app-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #cccccc;
}

.app-nav-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.app-nav-sections {
    flex: 1;
    overflow-y: auto;
}

.app-nav-section + .app-nav-section {
    margin-top: 1rem;
}

.app-nav-section h3 {
    margin: 0 0 0.3rem;
    font-size: 0.85rem;
    color: var(--gold-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.app-nav-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.app-nav-section li + li {
    margin-top: 0.15rem;
}

.app-nav-section a {
    display: block;
    padding: 0.3rem 0;
    font-size: 0.9rem;
    color: #f5f5f5;
    text-decoration: none;
}

.app-nav-section a:hover {
    color: var(--gold-light);
}

/* Estat obert: classe al body */
body.nav-open .app-nav {
    transform: translateX(0);
}

body.nav-open .app-nav-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* ─────────────────────────────────────────────
   3. CARDS I TIPOGRAFIA GENERAL DE PANTALLES
   ───────────────────────────────────────────── */

/* Targeta genèrica (login, dashboard...) */
.card {
    background: #FFFFFF;
    border-radius: 18px;
    padding: 1.75rem 1.75rem;
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(0, 0, 0, 0.08);
    max-width: 720px;
    margin: 0 auto;
}

/* Targetes d’articles / documents (plena amplada) */
.card-articles {
    max-width: 100%;
    width: 100%;
}

/* Capçalera / cos dins les cards (llistes, ofertes...) */
.card-header {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 0.75rem;
}

.card-body {
    padding-top: 0.25rem;
}

/* Títols i subtítols globals */
.page-title {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--grey-text);
    margin-bottom: 1.4rem;
}

/* ─────────────────────────────────────────────
   4. BOTONS, ENLLAÇOS I UTILITATS
   ───────────────────────────────────────────── */

/* Botó base (si cal fer servir .btn) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    border: none;
}

/* Botó principal (or daurat, com login) */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.3rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: var(--white);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.8rem;
    cursor: pointer;
}

/* Botó secundari (contorn daurat) */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--brand-primary);
    background-color: #ffffff;
    color: var(--brand-primary);
    text-decoration: none;
    cursor: pointer;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--gold-light);
    color: #ffffff;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Grup de botons (p. ex. cercar + netejar) */
.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* Enllaç estil “textual” dins taules o accions */


/* Utilitats de text / espaiat */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--grey-text);
    opacity: 0.8;
}

.mt-4 {
    margin-top: 1.5rem;
}




/* ─────────────────────────────────────────────
   5. MISSATGES (ERROR / OK / ALERTES)
   ───────────────────────────────────────────── */

.error-message {
    background: #fdecea;
    color: #C62828;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    font-size: 0.8rem;
    margin-bottom: 0.9rem;
    border: 1px solid rgba(198, 40, 40, 0.15);
}

.success-message {
    background: #e8f5e9;
    color: #2E7D32;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    font-size: 0.8rem;
    margin-bottom: 0.9rem;
    border: 1px solid rgba(46, 125, 50, 0.15);
}

.field-error {
    font-size: 0.75rem;
    color: #C62828;
    margin-top: 0.2rem;
}

/* Estil tipus Bootstrap per a .alert */
.alert {
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert-danger {
    background: #fdecea;
    color: #C62828;
    border: 1px solid rgba(198, 40, 40, 0.2);
}

/* ─────────────────────────────────────────────
   6. FORMULARIS I INPUTS
   ───────────────────────────────────────────── */

.form-group {
    margin-bottom: 1rem;
}

/* Inputs genèrics (filtres, etc.) */
.form-control {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 1px rgba(146, 111, 37, 0.2);
}

/* Input “client-input” (fitxa client) – mateix estil que form-control */
.client-input {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.client-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 1px rgba(146, 111, 37, 0.2);
}

/* ─────────────────────────────────────────────
   7. DASHBOARD GENERAL
   ───────────────────────────────────────────── */

.dashboard {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 0 2rem;
}

@media (min-width: 768px) {
    .dashboard {
        padding: 2rem 0 3rem;
    }
}

/* Capçalera del dashboard */
.dashboard-hero {
    margin-bottom: 1.5rem;
}

.dashboard-hello {
    font-size: 0.9rem;
    color: #777;
    margin: 0;
}

.dashboard-title {
    margin: 0.1rem 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: #222;
}

.dashboard-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: #555;
}

.dashboard-code {
    font-weight: 600;
    color: var(--brand-primary, #f28a00);
}

/* Grid d’àrees principals */
.dashboard-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* Targetes de secció (Articles, Documents, Cartera, Config) */
.dashboard-card {
    background: #ffffff;
    border-radius: 0.9rem;
    padding: 1rem 1.1rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: default;
}

.dashboard-card h2 {
    margin: 0 0 0.6rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #222;
}

.dashboard-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    color: #555;
}

.dashboard-card li + li {
    margin-top: 0.2rem;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

/* Colors per secció */
.dashboard-card--articles {
    border-top: 3px solid var(--brand-primary, #f28a00);
}

.dashboard-card--documents {
    border-top: 3px solid var(--brand-secondary, #0066cc);
}

.dashboard-card--cartera {
    border-top: 3px solid var(--brand-accent, #00a676);
}

.dashboard-card--config {
    border-top: 3px solid var(--brand-muted, #7b4bb7);
}

/* ─────────────────────────────────────────────
   8. CONFIGURACIÓ · DADES DEL CLIENT
   ───────────────────────────────────────────── */



/* Fitxa de dades client en format grid */





@media (max-width: 600px) {

}

/* ─────────────────────────────────────────────
   9. FILTRES I TAULES (Articles, Ofertes, etc.)
   ───────────────────────────────────────────── */

/* Barra de filtres general (contenidor)

/* Cada fila de filtres (per pantalles amb més d’una fila: Ofertes / Comandes) */


/* Grup de filtre (label + input/select) */

/* Grup d’accions (botons cercar / netejar) */

/* Label dels filtres */

/* Accions extra (si cal) */



/* Accions sobre la taula (info + export, etc.) */



/* Contenidor scroll horitzontal per taules */

/* Contenidor alternatiu (ofertes / compres) */

/* Taula principal */




/* Badges (p.ex. estat, etiquetes) */



/* ─────────────────────────────────────────────
   10. OFERTES · CAPÇALERA DE DETALL
   ───────────────────────────────────────────── */

/* Grid de capçalera al detall d’oferta */
.offer-header-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem 1.25rem;
    margin-bottom: 1.5rem;
}

.offer-header-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.offer-header-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--grey-text);
}

.offer-header-item .value {
    font-size: 0.95rem;
    font-weight: 600;
}

/* ─────────────────────────────────────────────
   11. DASHBOARD - CONTINGUT ESPECIAL (Nadal, notícies, articles)
   ───────────────────────────────────────────── */

/* Banner nadalenc */
.dashboard-xmas {
    padding: 1.5rem 1.5rem 0;
}

.dashboard-xmas-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #926F25, #B29A66);
    color: #ffffff;
    box-shadow: 0 5px 18px rgba(0,0,0,0.18);
}

.dashboard-xmas-text {
    flex: 1 1 260px;
}

.dashboard-xmas-greeting {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 0 0 0.25rem;
    opacity: 0.9;
}

.dashboard-xmas-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
}

.dashboard-xmas-subtitle {
    margin: 0;
    font-size: 0.9rem;
    max-width: 520px;
}

.dashboard-xmas-logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-xmas-logo img {
    max-width: 170px;
    height: auto;
    border-radius: 12px;
    background-color: #ffffff;
    padding: 0.4rem;
}

/* Notícies DOMENJÓ */
.dashboard-news {
    margin-top: 1.75rem;
    padding: 0 1.5rem;
}

.dashboard-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--black);
}

.dashboard-news-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.dashboard-news-card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    padding: 0.9rem 1.1rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.dashboard-news-meta {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--grey-text);
}

.dashboard-news-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.dashboard-news-text {
    margin: 0.1rem 0 0.3rem;
    font-size: 0.85rem;
    color: #333333;
}

.dashboard-news-link {
    font-size: 0.8rem;
    color: var(--brand-secondary);
    text-decoration: none;
    font-weight: 500;
}

.dashboard-news-link:hover {
    text-decoration: underline;
}

/* Articles del sector (cards amb imatge + text) */
.dashboard-articles {
    margin-top: 2rem;
    padding: 0 1.5rem 1.5rem;
}

.dashboard-articles-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.dashboard-article-card {
    display: flex;
    gap: 0.9rem;
    background-color: #ffffff;
    border-radius: 14px;
    border: 1px solid #e0e0e0;
    padding: 0.9rem 1rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
}

.dashboard-article-image img {
    display: block;
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
}

.dashboard-article-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.dashboard-article-source {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--grey-text);
}

.dashboard-article-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.dashboard-article-title a {
    color: var(--black);
    text-decoration: none;
}

.dashboard-article-title a:hover {
    text-decoration: underline;
}

.dashboard-article-excerpt {
    margin: 0.1rem 0 0.2rem;
    font-size: 0.85rem;
    color: #333333;
}

.dashboard-article-link {
    margin-top: 0.2rem;
    font-size: 0.8rem;
    color: var(--brand-secondary);
    text-decoration: none;
    font-weight: 500;
}

.dashboard-article-link:hover {
    text-decoration: underline;
}

/* Layout en pantalles grans (Xmas, articles, notícies) */
@media (min-width: 900px) {
    .dashboard-xmas-card {
        padding: 1.5rem 2rem;
    }

    .dashboard-articles-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-article-card {
        flex-direction: column;
    }

    .dashboard-article-image img {
        width: 100%;
        height: 140px;
    }

    .dashboard-news-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
