/* UPC Theme 2024 — Extranet Agències */

:root {
    --blue:       #00769d;
    --blue-dark:  #005F94;
    --blue-light: #007BC0;
    --bg:         #F4F6F9;
    --grey50:     #FAFAFA;
    --grey100:    #F5F5F5;
    --grey200:    #EEEEEE;
    --grey300:    #E0E0E0;
    --grey400:    #BDBDBD;
    --grey600:    #757575;
    --grey700:    #666666;
    --grey800:    #444444;
    --text:       #5e696f;
    --red:        #C81E1E;
    --red-dark:   #850505;
    --red-bg:     #FFF1F1;
    --green:      #007e33;
    --green-bg:   #f0fff4;
    --warning:    #d14900;
}

* { box-sizing: border-box; }

body {
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text);
    margin: 0;
}

a {
    color: var(--blue);
    text-decoration: none;
}
a:hover {
    color: var(--blue-dark);
    text-decoration: underline;
}

h1, h2, h3, h4, h5 {
    color: var(--blue);
    font-style: normal;
    line-height: normal;
    font-weight: 500;
}

/* ── Topbar ── */
.topbar {
    background: var(--blue-light);
    color: white;
    padding: 0;
    display: flex;
    align-items: stretch;
    min-height: 56px;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.topbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.25rem;
    text-decoration: none;
    border-right: 1px solid rgba(255,255,255,.2);
}

.topbar .navbar-brand img.logo-icon {
    height: 28px;
    width: auto;
    filter: brightness(0) invert(1);
}

.topbar .navbar-brand img.logo-text {
    height: 16px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: .92;
}

.topbar .app-title {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
    letter-spacing: .01em;
}

.topbar nav.top-nav {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.25rem;
}

.topbar nav.top-nav a {
    color: rgba(255,255,255,.85);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.topbar nav.top-nav a:hover,
.topbar nav.top-nav a.active {
    background: rgba(255,255,255,.15);
    color: white;
    text-decoration: none;
}

/* ── Layout ── */
main {
    padding: 1.75rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* ── Cards ── */
.card {
    background: white;
    border-radius: 6px;
    border: 1px solid var(--grey200);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--blue);
    border-bottom: 1px solid var(--grey200);
    padding-bottom: 0.6rem;
}

/* ── Tables ── */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid var(--grey200);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

th {
    background: var(--blue-light);
    color: white;
    padding: 0.7rem 1rem;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: .02em;
    text-transform: uppercase;
}

td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--grey200);
    font-size: 0.875rem;
    color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--grey50); }
tr:hover td { background: #e8f4fb; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: .02em;
}

.badge-proposta   { background: #fff3cd; color: #856404; }
.badge-espera     { background: #e8f5e9; color: #2e7d32; }
.badge-bitllets   { background: #cce5ff; color: #004085; }
.badge-finalitzat { background: #d4f0e0; color: var(--green); }
.badge-tramitat   { background: #ede7f6; color: #4527a0; }
.badge-cancelat   { background: var(--red-bg); color: var(--red); }
.badge-altres     { background: var(--grey200); color: var(--grey800); }

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    color: white;
    background: var(--blue);
    border: 1px solid var(--blue);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: white; text-decoration: none; }

.btn-veure    { background: var(--grey600); border-color: var(--grey600); }
.btn-veure:hover { background: var(--grey800); border-color: var(--grey800); }

.btn-bitllets { background: #0077a8; border-color: #0077a8; }
.btn-bitllets:hover { background: #005f87; border-color: #005f87; }

.btn-danger   { background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red-dark); border-color: var(--red-dark); }

.btn-success  { background: var(--green); border-color: var(--green); }
.btn-success:hover { background: #005a24; border-color: #005a24; }

.btn-cancelat { background: var(--red); border-color: var(--red); }
.btn-cancelat:hover { background: var(--red-dark); border-color: var(--red-dark); }

.btn-activar  { background: var(--green); border-color: var(--green); }
.btn-activar:hover { background: #005a24; border-color: #005a24; }

.btn-submit {
    padding: 0.5rem 1.5rem;
    background: var(--blue);
    color: white;
    border: 1px solid var(--blue);
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}
.btn-submit:hover { background: var(--blue-dark); border-color: var(--blue-dark); }

.btn-finalitzar { background: var(--green); border-color: var(--green); }
.btn-finalitzar:hover { background: #005a24; border-color: #005a24; }

.btn-file {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--grey700);
    background: white;
    border: 1px solid var(--grey300);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.btn-file:hover { background: var(--grey100); border-color: var(--grey400); }

/* ── Forms ── */
input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--grey300);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--grey800);
    background: white;
    transition: border-color .2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,118,157,.12);
}

input[disabled], input[readonly] {
    background: var(--grey100);
    color: var(--grey600);
    cursor: not-allowed;
}

textarea { resize: vertical; }

::placeholder { color: var(--grey600); font-style: italic; }

.field { display: flex; flex-direction: column; }
.field label { font-size: 0.8rem; color: var(--grey600); margin-bottom: 0.3rem; font-weight: 500; }
.field.full { grid-column: 1 / -1; }
.field span { font-size: 0.9rem; color: var(--grey800); }

.req  { color: var(--red); }
.info { color: var(--grey600); font-style: italic; font-size: 0.82rem; }

/* ── Messages ── */
.msg { padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem; font-size: 0.9rem; }
.msg-error   { background: var(--red-bg); border: 1px solid #f5c6c6; color: var(--red); }
.msg-success { background: var(--green-bg); border: 1px solid #9ed9b6; color: var(--green); }

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: 0.35rem 0.7rem;
    border-radius: 4px;
    border: 1px solid var(--grey300);
    background: white;
    color: var(--blue);
    text-decoration: none;
}
.pagination .current {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
    font-weight: 600;
}
.pagination a:hover { background: var(--grey100); text-decoration: none; }
.pagination .disabled { color: var(--grey400); border-color: var(--grey200); pointer-events: none; }

/* ── Page header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 1rem;
}
.page-header h2 { margin: 0; }

/* ── Grid ── */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 2rem;
}

/* ── Propostes / Bitllets ── */
.proposta {
    border: 1px solid var(--grey300);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.proposta-acceptada  { border-color: #9ed9b6; background: var(--green-bg); }
.proposta-rebutjada  { border-color: #f5c6c6; background: var(--red-bg); }
.proposta-espera     { border-color: #ffd77a; background: #fffdf0; }
.proposta-header {
    display: flex; gap: 1rem; align-items: center;
    margin-bottom: 0.75rem; flex-wrap: wrap;
}
.proposta-header .data  { color: var(--grey600); font-size: 0.82rem; }
.proposta-header .estat { font-size: 0.82rem; font-weight: 600; }
.proposta-text { font-size: 0.9rem; margin-bottom: 0.5rem; }
.docs { font-size: 0.85rem; margin-top: 0.5rem; }
.doc-item { display: inline-block; margin-right: 1rem; color: var(--blue); }
.doc-item:hover { color: var(--blue-dark); }
.modificacio {
    margin-top: 0.75rem; padding: 0.75rem;
    background: #fff8e1; border-radius: 4px; font-size: 0.88rem;
    border-left: 3px solid var(--warning);
}

/* ── Allotjament fieldset ── */
.allotjament-fieldset {
    border: 1px solid var(--grey300);
    border-radius: 4px;
    padding: 1rem 1.25rem;
    margin-top: 1rem;
}
.allotjament-fieldset legend {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--blue);
    padding: 0 0.5rem;
}

/* ── Dieta warning ── */
.dieta-warning {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--red-bg);
    border: 1px solid #f5c6c6;
    border-left: 4px solid var(--red);
    border-radius: 4px;
    color: var(--red);
    font-size: 0.9rem;
}

/* ── Missatgeria ── */
.missatge {
    border: 1px solid var(--grey300);
    border-radius: 4px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--grey50);
}
.missatge-last {
    border-color: var(--blue);
    background: #f0f7fc;
}
.missatge-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.missatge-header strong { color: var(--blue); font-size: 0.9rem; }
.missatge-header .data  { color: var(--grey600); font-size: 0.82rem; }
.missatge-cos { font-size: 0.88rem; color: var(--grey800); }
.missatge-cos p { margin: 0.25rem 0; }

/* ── Empty state ── */
.empty { color: var(--grey600); font-style: italic; padding: 1rem 0; }

/* ── Quill editor ── */
.ql-toolbar { border-color: var(--grey300) !important; border-radius: 4px 4px 0 0; }
.ql-container { border-color: var(--grey300) !important; border-radius: 0 0 4px 4px; font-size: 0.9rem; font-family: inherit; }
.ql-container:focus-within { border-color: var(--blue) !important; box-shadow: 0 0 0 3px rgba(0,118,157,.12); }
.ql-editor { min-height: 120px; color: var(--grey800); }
