/* ============================================================
   CONFIGURADOR ASCENSORS — Estils
   ============================================================ */

:root {
    --primary:      #006633;
    --primary-dark: #004d26;
    --success:      #057a55;
    --danger:       #c81e1e;
    --warning:      #c27803;
    --bg:           #f3f4f6;
    --surface:      #ffffff;
    --border:       #e5e7eb;
    --text:         #111827;
    --text-muted:   #6b7280;
    --sidebar-w:    240px;
    --radius:       8px;
    --shadow:       0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

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

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #006633 0%, #004d26 100%);
}

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

.login-box {
    background: var(--surface);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo img { height: 60px; margin-bottom: .5rem; }
.login-logo h1 { font-size: 1.4rem; color: var(--text); }
.login-logo p  { color: var(--text-muted); font-size: .85rem; }

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-page { display: flex; min-height: 100vh; }

/* Navbar lateral */
.admin-nav {
    width: var(--sidebar-w);
    background: #0a1f0f;
    color: #c9d3e0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
}

.nav-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    font-weight: 700;
    font-size: .95rem;
    color: #fff;
}

.nav-menu { flex: 1; padding: .75rem 0; overflow-y: auto; }

.nav-item a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem 1.25rem;
    color: #c9d3e0;
    transition: background .15s, color .15s;
    border-radius: 0;
    text-decoration: none;
}
.nav-item a:hover,
.nav-item.active a {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.nav-item .icon { width: 18px; text-align: center; }

.nav-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: .8rem;
    color: #8a9bb0;
}

.admin-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; }
.benvinguda { color: var(--text-muted); font-size: .9rem; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 1rem; }
.card-body { padding: 1.25rem; }

/* ============================================================
   STATS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-card.accent { border-left: 4px solid var(--primary); }
.stat-icon { font-size: 1.75rem; }
.stat-num  { display: block; font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-label{ display: block; font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* ============================================================
   QUICK ACTIONS
   ============================================================ */
.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.quick-action-btn {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .85rem 1.25rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: box-shadow .15s, transform .1s;
}
.quick-action-btn:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    transform: translateY(-1px);
    text-decoration: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-outline { background: transparent; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   TABLES
   ============================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.table th {
    text-align: left;
    padding: .6rem .75rem;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
}
.table td {
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tr:hover td { background: #f9fafb; }
.row-inactiva td { opacity: .5; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 1.25rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

label {
    display: block;
    font-weight: 500;
    margin-bottom: .4rem;
    font-size: .875rem;
}
.required { color: var(--danger); }

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=tel],
textarea,
select {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .875rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,102,51,.15);
}
textarea { resize: vertical; }
small { display: block; color: var(--text-muted); font-size: .78rem; margin-top: .25rem; }

.checkbox-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.checkbox-label input { width: auto; }

.form-actions {
    display: flex;
    gap: .75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

/* ============================================================
   FILTERS
   ============================================================ */
.filters-card { padding: 1rem 1.25rem; }
.filters-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.filter-group { display: flex; flex-direction: column; gap: .25rem; min-width: 150px; }
.filter-group label { font-size: .8rem; font-weight: 500; margin: 0; }
.filter-group select,
.filter-group input { width: auto; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-pendent  { background: #fef3c7; color: #92400e; }
.badge-enviat   { background: #dbeafe; color: #006633; }
.badge-acceptat { background: #d1fae5; color: #065f46; }
.badge-rebutjat { background: #fee2e2; color: #991b1b; }
.badge-caducat  { background: #f3f4f6; color: #374151; }
.badge-cat      { background: #e0e7ff; color: #3730a3; }

.toggle-btn { background: none; border: none; cursor: pointer; font-size: 1.1rem; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .875rem;
}
.alert ul { margin: .4rem 0 0 1.2rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ============================================================
   UTILS
   ============================================================ */
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: .5rem; }
.d-block { display: block; }
code {
    background: var(--bg);
    padding: .1rem .35rem;
    border-radius: 4px;
    font-size: .8rem;
    font-family: 'Courier New', monospace;
}

/* ============================================================
   WIZARD (part pública)
   ============================================================ */
.wizard-page {
    background: linear-gradient(135deg, #e8f5ee 0%, #f0faf4 100%);
    min-height: 100vh;
}

.wizard-header {
    background: #fff;
    padding: 1rem 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wizard-container {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.wizard-progress {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}
.progress-bar-wrap {
    background: var(--bg);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
    margin-top: .5rem;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width .4s ease;
}
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .4rem;
}

.wizard-card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
}

.wizard-card h2 {
    font-size: 1.3rem;
    margin-bottom: .5rem;
}
.wizard-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: .9rem;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Opció visual (radio/checkbox estilitzat) */
.opcions-visuals { display: grid; gap: .75rem; }
.opcions-visuals.cols-2 { grid-template-columns: 1fr 1fr; }

.opcio-visual {
    position: relative;
}
.opcio-visual input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.opcio-visual label {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-weight: normal;
    margin: 0;
}
.opcio-visual input:checked + label {
    border-color: var(--primary);
    background: #e8f5ee;
}
.opcio-visual label:hover { border-color: #93c5fd; }
.opcio-visual .opcio-icon { font-size: 1.5rem; flex-shrink: 0; }
.opcio-visual .opcio-text strong { display: block; margin-bottom: .2rem; }
.opcio-visual .opcio-text small { color: var(--text-muted); }

/* Infobox */
.infobox {
    background: #e8f5ee;
    border: 1px solid #a7d4b8;
    border-radius: var(--radius);
    padding: .85rem 1rem;
    margin-bottom: 1rem;
    font-size: .875rem;
    color: #006633;
}

.error-box {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}
.error-box h2 { color: var(--danger); margin-bottom: .5rem; }

/* Resum pressupost */
.resum-taula { width: 100%; border-collapse: collapse; }
.resum-taula td { padding: .5rem .25rem; border-bottom: 1px solid var(--border); }
.resum-taula .total-row td { font-weight: 700; font-size: 1.1rem; border-bottom: none; padding-top: 1rem; }
.resum-taula .cat-header td { font-weight: 600; background: var(--bg); padding: .4rem .25rem; font-size: .8rem; text-transform: uppercase; color: var(--text-muted); }

@media (max-width: 768px) {
    .admin-nav { transform: translateX(-100%); transition: transform .2s; }
    .admin-main { margin-left: 0; padding: 1rem; }
    .opcions-visuals.cols-2 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .filters-form { flex-direction: column; }
}

/* Paginació */
.paginacio { display:flex;gap:.4rem;margin-top:1rem;flex-wrap:wrap; }
.pag-btn {
    display:inline-flex;align-items:center;justify-content:center;
    width:32px;height:32px;border-radius:6px;
    border:1px solid var(--border);background:var(--surface);
    color:var(--text);font-size:.85rem;text-decoration:none;
}
.pag-btn.active { background:var(--primary);color:#fff;border-color:var(--primary); }
.pag-btn:hover:not(.active) { background:var(--bg);text-decoration:none; }

/* Select estat inline */
.badge-select {
    border:none;background:transparent;cursor:pointer;
    font-size:.78rem;font-weight:600;padding:.2rem .4rem;
    border-radius:999px;
}
.badge-select.badge-pendent  { background:#fef3c7;color:#92400e; }
.badge-select.badge-enviat   { background:#dbeafe;color:#1e40af; }
.badge-select.badge-acceptat { background:#d1fae5;color:#065f46; }
.badge-select.badge-rebutjat { background:#fee2e2;color:#991b1b; }
.badge-select.badge-caducat  { background:#f3f4f6;color:#374151; }
