/* =============================================
   IMPULS - Sistema de Gestió L'Espiga d'Or
   Tema: Executive Earth
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;500;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
    --earth:       #3d2e1e;
    --earth-mid:   #5c4a36;
    --gold:        #c9a227;
    --gold-soft:   #d4a574;
    --gold-pale:   #f5e6d0;
    --cream:       #faf7f2;
    --cream-dark:  #f0ebe3;
    --text-dark:   #2c1f10;
    --text-mid:    #7a6b5a;
    --border:      #e5ddd2;
    --white:       #ffffff;
    --shadow:      rgba(61, 46, 30, 0.10);
}

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

body {
    font-family: 'Source Sans 3', sans-serif;
    background-color: var(--cream-dark);
    color: var(--text-dark);
    line-height: 1.6;
}

/* ============================================= */
/* LOGIN                                         */
/* ============================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream-dark);
    padding: 24px 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header img {
    max-width: 260px;
    width: 80%;
    height: auto;
    display: block;
    margin: 0 auto 10px;
}

.login-header p {
    color: var(--text-mid);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    margin-top: 4px;
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 32px 28px;
    box-shadow: 0 8px 40px var(--shadow);
    border: 1px solid var(--border);
}

.login-form .form-group { margin-bottom: 18px; }

.login-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--earth-mid);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}

.login-form input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Source Sans 3', sans-serif;
    color: var(--text-dark);
    background: var(--cream);
    transition: border-color 0.2s, background 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--white);
}

.btn-login {
    width: 100%;
    padding: 13px;
    background: var(--earth);
    color: var(--gold-pale);
    border: none;
    border-radius: 8px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.16em;
    margin-top: 10px;
    transition: background 0.2s;
}

.btn-login:hover { background: var(--earth-mid); }

/* ============================================= */
/* ALERTES                                       */
/* ============================================= */

.alert {
    padding: 11px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 0.88rem;
}

.alert-error  { background:#fef2f2; border:1px solid #fecaca; color:#991b1b; }
.alert-success{ background:#f0fdf4; border:1px solid #bbf7d0; color:#166534; }

/* ============================================= */
/* DASHBOARD - HEADER                            */
/*                                               */
/*  .header-top  →  [LOGO]          [btn logout] */
/*  .header-sub  →  [Títol pàgina · Benvinguda]  */
/* ============================================= */

.dashboard {
    min-height: 100vh;
    background: var(--cream-dark);
}

.dashboard-header {
    background: var(--cream);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 8px var(--shadow);
}

/* Fila 1: logo + logout */
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    gap: 12px;
}

.header-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.header-logo img {
    height: 52px;
    width: auto;
    display: block;
}

/* Fila 2: títol + benvinguda */
.header-sub {
    background: var(--earth);
    padding: 5px 20px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.header-sub h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gold-pale);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.header-sub .sep {
    color: var(--gold-soft);
    opacity: 0.4;
    font-size: 0.75rem;
}

.header-sub p {
    font-size: 0.75rem;
    color: var(--gold-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================= */
/* CONTINGUT                                     */
/* ============================================= */

.dashboard-content {
    padding: 18px 16px;
    max-width: 900px;
    margin: 0 auto;
}

/* ============================================= */
/* CARDS                                         */
/* ============================================= */

.card {
    background: var(--white);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--earth);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gold-pale);
    letter-spacing: 0.02em;
}

/* ============================================= */
/* BOTONS                                        */
/* ============================================= */

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 7px;
    text-decoration: none;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-logout {
    background: var(--gold);
    color: var(--earth);
    padding: 8px 16px;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.btn-logout:hover { background: var(--gold-soft); }

.btn-primary { background: var(--earth); color: var(--gold-pale); }
.btn-primary:hover { background: var(--earth-mid); }

.btn-secondary {
    background: var(--cream-dark);
    color: var(--earth-mid);
    border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

/* ============================================= */
/* BARRES DE PROGRÉS                             */
/* ============================================= */

.progress-container { margin-bottom: 14px; }

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
    font-size: 0.82rem;
    color: var(--text-mid);
    font-weight: 500;
    gap: 8px;
}

.pct-value {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.progress-bar-bg {
    background: var(--cream-dark);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
    min-width: 2px;
}

.progress-red    { background: linear-gradient(90deg, #dc2626, #b91c1c); }
.progress-orange { background: linear-gradient(90deg, #ea580c, #c2410c); }
.progress-yellow { background: linear-gradient(90deg, #ca8a04, #a16207); }
.progress-green  { background: linear-gradient(90deg, #16a34a, #15803d); }

/* ============================================= */
/* MÈTRIQUES                                     */
/* ============================================= */

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--cream-dark);
}

.metric-row:last-child { border-bottom: none; }

.metric-label { font-size: 0.85rem; color: var(--text-mid); }

.metric-value {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--earth);
}

.metric-value.good { color: #16a34a; }
.metric-value.warn { color: #ea580c; }
.metric-value.bad  { color: #dc2626; }
.metric-value.pending {
    color: var(--text-mid);
    font-size: 0.85rem;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-style: italic;
}

/* ============================================= */
/* TAULA                                         */
/* ============================================= */

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }

table th {
    background: var(--earth);
    color: var(--gold-pale);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
}

table td { padding: 10px 12px; border-bottom: 1px solid var(--cream-dark); }
table tr:hover td { background: var(--cream); }

/* ============================================= */
/* GRID LOCALS (superadmin)                      */
/* ============================================= */

.locales-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }

@media (min-width: 600px) { .locales-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .locales-grid { grid-template-columns: repeat(3, 1fr); } }

.local-card {
    background: var(--white);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
    border-left: 4px solid var(--gold);
}

.local-card h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--earth);
    margin-bottom: 10px;
}

/* ============================================= */
/* MENÚ NAV                                      */
/* ============================================= */

.nav-menu { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.nav-menu a {
    background: var(--white);
    border: 1.5px solid var(--gold);
    color: var(--earth-mid);
    padding: 7px 14px;
    border-radius: 7px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: var(--earth);
    border-color: var(--earth);
    color: var(--gold-pale);
}

/* ============================================= */
/* FORMULARIS                                    */
/* ============================================= */

.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--earth-mid);
    font-size: 0.85rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Source Sans 3', sans-serif;
    color: var(--text-dark);
    background: var(--cream);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--white);
}

/* ============================================= */
/* NOTA PEU                                      */
/* ============================================= */

.nota-peu {
    text-align: center;
    color: var(--text-mid);
    font-size: 0.78rem;
    margin-top: 8px;
    font-style: italic;
}

/* ============================================= */
/* RESPONSIVE MÒBIL                              */
/* ============================================= */

@media (max-width: 480px) {
    .header-top { padding: 8px 14px; }
    .header-logo img { height: 42px; }
    .btn-logout { padding: 6px 11px; font-size: 0.73rem; }
    .header-sub { padding: 5px 14px; }
    .header-sub h1 { font-size: 0.88rem; }
    .header-sub p { font-size: 0.7rem; }
    .dashboard-content { padding: 12px; }
    .card { padding: 14px; }
    .nav-menu a { font-size: 0.78rem; padding: 6px 10px; }
}
