/* ═══════════════════════════════════════════════════════════════════════════
   GESTOR DE FICHAS MUNICIPALES — style.css
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
    --gfm-green:        #064e3b;
    --gfm-green-mid:    #047857;
    --gfm-green-light:  #d1fae5;
    --gfm-green-xlight: #ecfdf5;
    --gfm-accent:       #059669;
    --gfm-red:          #dc2626;
    --gfm-blue:         #1d4ed8;
    --gfm-amber:        #d97706;
    --gfm-gray-50:      #f9fafb;
    --gfm-gray-100:     #f3f4f6;
    --gfm-gray-200:     #e5e7eb;
    --gfm-gray-400:     #9ca3af;
    --gfm-gray-600:     #4b5563;
    --gfm-gray-800:     #1f2937;
    --gfm-radius:       8px;
    --gfm-shadow:       0 4px 24px rgba(6,78,59,.10);
    --gfm-shadow-sm:    0 1px 4px rgba(0,0,0,.08);
    --gfm-font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Wrapper principal ─────────────────────────────────────────────────── */
.gfm-wrapper {
    font-family: var(--gfm-font);
    color: var(--gfm-gray-800);
    max-width: 860px;
    margin: 0 auto;
}

/* ── Ficha preview (hoja A4) ───────────────────────────────────────────── */
.gfm-ficha-preview {
    background: #fff;
    border-radius: var(--gfm-radius);
    box-shadow: var(--gfm-shadow);
    padding: 32px 36px;
    margin-bottom: 24px;
}

/* ── Encabezado ────────────────────────────────────────────────────────── */
.gfm-header {
    display: flex;
    align-items: center;
    gap: 16px;
    border: 2px solid var(--gfm-green);
    border-radius: var(--gfm-radius);
    padding: 16px;
    margin-bottom: 24px;
    background: var(--gfm-green-xlight);
}
.gfm-header-icon {
    color: var(--gfm-green);
    flex-shrink: 0;
}
.gfm-header-center {
    flex: 1;
    text-align: center;
}
.gfm-header-center h1 {
    font-size: .95rem;
    font-weight: 700;
    color: var(--gfm-green);
    margin: 0 0 2px;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.gfm-header-center h2 {
    font-size: .8rem;
    font-weight: 800;
    color: var(--gfm-gray-800);
    margin: 0 0 2px;
}
.gfm-header-center p {
    font-size: .7rem;
    color: var(--gfm-accent);
    font-style: italic;
    margin: 0;
}
.gfm-header-code {
    text-align: center;
    font-size: .65rem;
    color: var(--gfm-gray-600);
    border-left: 1px solid var(--gfm-green);
    padding-left: 12px;
    min-width: 90px;
    flex-shrink: 0;
}
.gfm-code-value {
    display: block;
    font-size: .85rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--gfm-green);
    margin-top: 4px;
}

/* ── Secciones ─────────────────────────────────────────────────────────── */
.gfm-section {
    margin-bottom: 20px;
    border: 1px solid var(--gfm-gray-200);
    border-radius: var(--gfm-radius);
    overflow: hidden;
}
.gfm-section-header {
    background: var(--gfm-green);
    color: #fff;
    padding: 7px 14px;
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.gfm-section-body {
    padding: 16px;
    background: var(--gfm-gray-50);
}

/* ── Grids ─────────────────────────────────────────────────────────────── */
.gfm-grid      { display: grid; gap: 12px; }
.gfm-grid-1    { grid-template-columns: 1fr; }
.gfm-grid-2    { grid-template-columns: 1fr 1fr; }
.gfm-grid-3    { grid-template-columns: 1fr 1fr 1fr; }
.gfm-col-2     { grid-column: span 2; }
.gfm-col-3     { grid-column: span 3; }

/* ── Campo de formulario ───────────────────────────────────────────────── */
.gfm-field label,
.gfm-label-block {
    display: block;
    font-size: .68rem;
    font-weight: 700;
    color: var(--gfm-gray-600);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 4px;
}
.gfm-req { color: var(--gfm-red); }

.gfm-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--gfm-gray-200);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: .82rem;
    font-family: var(--gfm-font);
    background: #fff;
    color: var(--gfm-gray-800);
    transition: border-color .15s, box-shadow .15s;
}
.gfm-input:focus {
    outline: none;
    border-color: var(--gfm-accent);
    box-shadow: 0 0 0 3px rgba(5,150,105,.15);
}
.gfm-textarea { resize: vertical; min-height: 80px; }
.gfm-input-xs { padding: 4px 6px; font-size: .75rem; }

.gfm-input-prefix {
    display: flex;
    align-items: center;
    border: 1px solid var(--gfm-gray-200);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.gfm-input-prefix span {
    padding: 8px 10px;
    background: var(--gfm-gray-100);
    font-size: .8rem;
    font-weight: 700;
    color: var(--gfm-gray-600);
    border-right: 1px solid var(--gfm-gray-200);
    white-space: nowrap;
}
.gfm-input-prefix .gfm-input {
    border: none;
    border-radius: 0;
}
.gfm-input-prefix .gfm-input:focus { box-shadow: none; }

/* ── Ejes temáticos (radio cards) ──────────────────────────────────────── */
.gfm-ejes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
}
.gfm-eje-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid var(--gfm-gray-200);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all .15s;
    background: #fff;
}
.gfm-eje-option:hover { border-color: var(--gfm-accent); background: var(--gfm-green-xlight); }
.gfm-eje-option.is-active,
.gfm-eje-option input:checked ~ * {
    border-color: var(--gfm-green);
    background: var(--gfm-green-light);
}
.gfm-eje-option input[type="radio"] { display: none; }
.gfm-eje-icon { color: var(--gfm-green); line-height: 1; }
.gfm-eje-label { font-size: .65rem; font-weight: 600; color: var(--gfm-gray-800); line-height: 1.2; }

/* ── Estado radios ─────────────────────────────────────────────────────── */
.gfm-estado-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.gfm-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    cursor: pointer;
}
.gfm-radio-label input { accent-color: var(--gfm-green); }

/* ── Firmas ────────────────────────────────────────────────────────────── */
.gfm-firmas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 32px;
    text-align: center;
}
.gfm-firma-box { display: flex; flex-direction: column; align-items: center; }
.gfm-firma-line {
    width: 180px;
    height: 1px;
    background: var(--gfm-gray-800);
    margin-bottom: 6px;
}
.gfm-firma-oficial .gfm-firma-line { background: var(--gfm-gray-200); }
.gfm-firma-title { font-size: .65rem; font-weight: 700; margin: 0; text-transform: uppercase; }
.gfm-firma-oficial .gfm-firma-title { color: var(--gfm-gray-400); }
.gfm-firma-sub { font-size: .6rem; color: var(--gfm-gray-400); margin: 2px 0 0; }
.gfm-disclaimer { font-size: .65rem; color: var(--gfm-gray-400); font-style: italic; margin-top: 16px; border-top: 1px solid var(--gfm-gray-200); padding-top: 10px; }

/* ── Botones de acción ─────────────────────────────────────────────────── */
.gfm-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid var(--gfm-gray-100);
}
.gfm-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: 7px;
    font-size: .82rem;
    font-weight: 700;
    font-family: var(--gfm-font);
    cursor: pointer;
    border: none;
    transition: all .15s;
    text-decoration: none;
    line-height: 1;
}
.gfm-btn-primary  { background: var(--gfm-green); color: #fff; }
.gfm-btn-primary:hover  { background: var(--gfm-green-mid); color: #fff; }
.gfm-btn-danger   { background: var(--gfm-red); color: #fff; }
.gfm-btn-danger:hover   { background: #b91c1c; color: #fff; }
.gfm-btn-secondary{ background: var(--gfm-gray-100); color: var(--gfm-gray-800); border: 1px solid var(--gfm-gray-200); }
.gfm-btn-secondary:hover{ background: var(--gfm-gray-200); }
.gfm-btn-ghost    { background: transparent; color: var(--gfm-gray-600); border: 1px solid var(--gfm-gray-200); }
.gfm-btn-ghost:hover    { background: var(--gfm-gray-100); }

/* ── Mensaje formulario ────────────────────────────────────────────────── */
.gfm-form-msg {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 7px;
    font-size: .85rem;
    font-weight: 600;
}
.gfm-form-msg.success { background: var(--gfm-green-light); color: var(--gfm-green); border-left: 4px solid var(--gfm-green); }
.gfm-form-msg.error   { background: #fee2e2; color: var(--gfm-red); border-left: 4px solid var(--gfm-red); }

/* ── Notices ───────────────────────────────────────────────────────────── */
.gfm-notice {
    padding: 12px 16px;
    border-radius: 7px;
    font-size: .85rem;
    margin-bottom: 16px;
}
.gfm-notice-warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--gfm-amber); }
.gfm-notice-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--gfm-red); }
.gfm-notice-info    { background: #eff6ff; color: #1e40af; border-left: 4px solid var(--gfm-blue); }
.gfm-notice-success { background: var(--gfm-green-light); color: var(--gfm-green); border-left: 4px solid var(--gfm-green); }

/* ── Lista de fichas ───────────────────────────────────────────────────── */
.gfm-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.gfm-list-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gfm-green);
    margin: 0;
}

/* ── Filtros ───────────────────────────────────────────────────────────── */
.gfm-filters {
    background: var(--gfm-gray-50);
    border: 1px solid var(--gfm-gray-200);
    border-radius: var(--gfm-radius);
    padding: 14px 16px;
    margin-bottom: 20px;
}
.gfm-filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.gfm-filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.gfm-filter-field label { font-size: .68rem; font-weight: 700; color: var(--gfm-gray-600); text-transform: uppercase; }
.gfm-filter-actions { display: flex; gap: 8px; align-items: flex-end; }

/* ── Tabla ─────────────────────────────────────────────────────────────── */
.gfm-table-wrap { overflow-x: auto; border-radius: var(--gfm-radius); box-shadow: var(--gfm-shadow-sm); }
.gfm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
    background: #fff;
}
.gfm-table thead th {
    background: var(--gfm-green);
    color: #fff;
    padding: 10px 12px;
    text-align: left;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.gfm-table tbody tr { border-bottom: 1px solid var(--gfm-gray-100); transition: background .1s; }
.gfm-table tbody tr:hover { background: var(--gfm-green-xlight); }
.gfm-table td { padding: 9px 12px; vertical-align: middle; }
.gfm-td-proyecto { max-width: 220px; }
.gfm-td-num { text-align: right; font-variant-numeric: tabular-nums; }
.gfm-td-actions { white-space: nowrap; display: flex; gap: 6px; }

/* ── Badges y tags ─────────────────────────────────────────────────────── */
.gfm-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
}
.gfm-badge-idea       { background: #fef3c7; color: #92400e; }
.gfm-badge-perfil     { background: #dbeafe; color: #1e40af; }
.gfm-badge-expediente { background: var(--gfm-green-light); color: var(--gfm-green); }

.gfm-tag { font-size: .7rem; padding: 2px 7px; border-radius: 4px; }
.gfm-tag-eje { background: var(--gfm-green-light); color: var(--gfm-green); font-weight: 600; }

/* ── Botones de icono ──────────────────────────────────────────────────── */
.gfm-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    background: transparent;
}
.gfm-btn-icon-edit { color: var(--gfm-blue); }
.gfm-btn-icon-edit:hover { background: #dbeafe; color: var(--gfm-blue); }
.gfm-btn-icon-pdf  { color: var(--gfm-red); }
.gfm-btn-icon-pdf:hover  { background: #fee2e2; color: var(--gfm-red); }
.gfm-btn-icon-del  { color: var(--gfm-gray-400); }
.gfm-btn-icon-del:hover  { background: #fee2e2; color: var(--gfm-red); }

/* ── Estado vacío ──────────────────────────────────────────────────────── */
.gfm-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--gfm-gray-400);
}
.gfm-empty svg { color: var(--gfm-gray-200); margin-bottom: 12px; }
.gfm-empty p { font-size: .9rem; margin: 0 0 16px; }

.gfm-list-count { font-size: .75rem; color: var(--gfm-gray-400); margin-top: 10px; text-align: right; }

/* ── PDF sheet ─────────────────────────────────────────────────────────── */
.gfm-pdf-sheet { width: 210mm; padding: 15mm; background: #fff; font-size: 11pt; }
.gfm-pdf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gfm-pdf-field { font-size: 9pt; padding: 4px 0; }
.gfm-pdf-full { grid-column: span 2; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
    .gfm-grid-2, .gfm-grid-3 { grid-template-columns: 1fr; }
    .gfm-col-2, .gfm-col-3   { grid-column: span 1; }
    .gfm-ejes-grid            { grid-template-columns: repeat(2, 1fr); }
    .gfm-firmas               { grid-template-columns: 1fr; }
    .gfm-filter-row           { flex-direction: column; }
    .gfm-ficha-preview        { padding: 20px 16px; }
}

/* ── Impresión ─────────────────────────────────────────────────────────── */
@media print {
    .gfm-actions,
    .gfm-filters,
    .gfm-list-header .gfm-btn,
    .no-print { display: none !important; }
    .gfm-ficha-preview { box-shadow: none; padding: 0; }
    body { background: white; }
}
