/* =============================================================================
   styles.css — Sistema ARECH · Municipio de Rada Tilly
   -----------------------------------------------------------------------------
   Hoja de estilos rebrandeada según el Manual de Marca de Rada Tilly.
   Toda la paleta vive en variables CSS (:root) para que cualquier ajuste de
   color se haga en un solo lugar. Tipografías oficiales: DM Sans (títulos),
   Open Sans (cuerpo), Inter (apoyo).
   ============================================================================= */

:root {
    /* ---- Paleta principal (Manual de marca · pág. "Paleta de colores") ---- */
    --rt-petroleo:      #154F4A;  /* verde petróleo · header, botones oscuros */
    --rt-petroleo-2:    #1d6b64;  /* variante para degradados */
    --rt-teal:          #209996;  /* verde institucional · acción primaria */
    --rt-teal-light:    #34AEB2;  /* teal claro · hover / acentos */
    --rt-teal-dark:     #1a7d7a;  /* teal oscuro · hover de botón primario */

    /* ---- Secundarios -------------------------------------------------------- */
    --rt-navy:          #30327E;  /* azul institucional */
    --rt-celeste:       #83B2CC;  /* celeste */
    --rt-oliva:         #8E8B2E;  /* oliva · texto dorado legible sobre claro */
    --rt-magenta:       #C363A3;  /* magenta */
    --rt-dorado:        #E2C65A;  /* dorado · destacados, reloj, resaltado */
    --rt-dorado-light:  #F1D174;  /* dorado claro */

    /* ---- Tintes suaves (fondos de íconos / chips) -------------------------- */
    --rt-teal-tint:     #e6f7f5;
    --rt-dorado-tint:   #fcf4dd;
    --rt-navy-tint:     #e8eaf3;
    --rt-gris-tint:     #f0f0f0;
    --rt-rojo:          #dc3545;
    --rt-rojo-tint:     #fef2f2;

    /* ---- Neutros / superficie ---------------------------------------------- */
    --rt-bg:            #f4f6f8;
    --rt-surface:       #ffffff;
    --rt-borde:         #eeeeee;
    --rt-borde-input:   #e0e0e0;
    --rt-texto:         #333333;
    --rt-texto-suave:   #666666;
    --rt-texto-tenue:   #999999;

    /* ---- Tipografías -------------------------------------------------------- */
    --rt-font-display:  'DM Sans', 'Inter', system-ui, sans-serif;  /* títulos */
    --rt-font-body:     'Open Sans', 'Inter', system-ui, sans-serif;/* cuerpo  */
    --rt-radio:         10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--rt-font-body); background: var(--rt-bg); min-height: 100vh; }

/* ============ LOGIN ============ */
.login-container { display: flex; min-height: 100vh; }
.login-left {
    flex: 1.4; position: relative; overflow: hidden;
    background: url('old/fondo.jpg') center/cover no-repeat;
}
.login-left::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(21,79,74,0.78) 0%, rgba(32,153,150,0.45) 100%);
}
.login-left-content {
    position: relative; z-index: 1; text-align: center; color: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; padding: 40px;
}
.login-left-content .badge {
    background: rgba(32,153,150,0.85); padding: 6px 16px; border-radius: 20px;
    font-size: 12px; font-weight: 500; margin-bottom: 20px; text-transform: lowercase;
    display: inline-flex; align-items: center; gap: 6px;
}
.login-left-content .badge::before { content: '●'; color: var(--rt-teal-light); font-size: 8px; }
.login-left-content h1 {
    font-family: var(--rt-font-display);
    font-size: 42px; font-weight: 700; line-height: 1.2; margin-bottom: 16px; text-transform: lowercase;
}
.login-left-content h1 .highlight { color: var(--rt-dorado); font-style: italic; }
.login-left-content p { font-size: 15px; opacity: 0.85; max-width: 400px; line-height: 1.5; }
.login-right {
    flex: 0.8; display: flex; align-items: center; justify-content: center;
    background: #fff; padding: 40px;
}
.login-card { width: 100%; max-width: 360px; }
.login-card .logo-section { text-align: center; margin-bottom: 24px; }
.login-card .logo-section img { height: 56px; margin-bottom: 8px; }
.login-card .logo-section .logo-text { font-size: 14px; color: var(--rt-texto-suave); }
.login-card .divider { width: 40px; height: 3px; background: var(--rt-teal); margin: 16px auto; border-radius: 2px; }
.login-card .welcome-text { text-align: center; margin-bottom: 24px; }
.login-card .welcome-text h2 { font-family: var(--rt-font-display); font-size: 20px; color: var(--rt-petroleo); margin-bottom: 6px; }
.login-card .welcome-text p { font-size: 13px; color: var(--rt-texto-suave); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 11px; font-weight: 600; color: #555; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.input-wrapper { position: relative; }
.input-wrapper i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #aaa; font-size: 14px; }
.input-wrapper input, .input-wrapper select {
    width: 100%; padding: 12px 14px 12px 38px; border: 1px solid var(--rt-borde-input);
    border-radius: var(--rt-radio); font-size: 14px; transition: all 0.2s; background: #f9fafb;
    font-family: var(--rt-font-body);
}
.input-wrapper input:focus, .input-wrapper select:focus { outline: none; border-color: var(--rt-teal); background: #fff; box-shadow: 0 0 0 3px rgba(32,153,150,0.12); }
.btn-login {
    width: 100%; padding: 13px; background: var(--rt-petroleo); color: #fff; border: none;
    border-radius: var(--rt-radio); font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--rt-font-body);
}
.btn-login:hover { background: var(--rt-teal); }
.login-footer { text-align: center; margin-top: 20px; font-size: 11px; color: var(--rt-texto-tenue); display: flex; align-items: center; justify-content: center; gap: 6px; }
.login-error { background: var(--rt-rojo-tint); color: var(--rt-rojo); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; display: none; border: 1px solid #fecaca; }

/* ============ HEADER ============ */
.header { background: var(--rt-petroleo); padding: 12px 28px; display: flex; align-items: center; justify-content: space-between; }
.header-logo { display: flex; align-items: center; gap: 10px; }
.header-logo img { height: 32px; filter: brightness(10); }
.header-logo span { font-family: var(--rt-font-display); color: #fff; font-size: 15px; font-weight: 600; }
.header-center { color: #fff; font-size: 13px; text-align: center; text-transform: lowercase; }
.header-center .hora { color: var(--rt-dorado); font-weight: 700; font-size: 15px; margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav-item {
    color: #fff; font-size: 12px; padding: 8px 14px; border-radius: 6px; text-transform: lowercase;
    cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s;
    background: rgba(255,255,255,0.1); border: none; font-family: var(--rt-font-body);
}
.header-nav-item:hover { background: rgba(255,255,255,0.2); }
.header-nav-item.active { background: var(--rt-teal); }
.header-user { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 13px; }
.header-user .avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--rt-teal);
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #fff;
}
.btn-salir {
    background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #fff;
    padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 12px;
    transition: all 0.2s; display: flex; align-items: center; gap: 5px;
}
.btn-salir:hover { background: #fff; color: var(--rt-petroleo); }
.barra-bienvenida { background: linear-gradient(90deg, var(--rt-petroleo), var(--rt-petroleo-2)); padding: 10px 28px; border-top: 1px solid rgba(255,255,255,0.1); }
.barra-bienvenida span { color: #cdd; font-size: 13px; }
.barra-bienvenida .nombre-user { color: var(--rt-dorado); font-weight: 600; }

/* ============ MAIN ============ */
.main-content { padding: 28px; max-width: 1300px; margin: 0 auto; }
.page-title-section { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title-section h1 { font-family: var(--rt-font-display); font-size: 22px; color: var(--rt-petroleo); font-weight: 700; display: flex; align-items: center; gap: 10px; text-transform: lowercase; }
.page-title-section p { font-size: 13px; color: var(--rt-texto-suave); margin-top: 2px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--rt-surface); border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); border: 1px solid var(--rt-borde); display: flex; align-items: center; gap: 14px; transition: all 0.2s; }
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-1px); }
.stat-card .stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-card .stat-icon.teal { background: var(--rt-teal-tint); color: var(--rt-teal); }
.stat-card .stat-icon.yellow { background: var(--rt-dorado-tint); color: var(--rt-oliva); }
.stat-card .stat-icon.blue { background: var(--rt-navy-tint); color: var(--rt-navy); }
.stat-card .stat-icon.gray { background: var(--rt-gris-tint); color: var(--rt-texto-suave); }
.stat-card .stat-icon.red { background: var(--rt-rojo-tint); color: var(--rt-rojo); }
.stat-card .stat-info .stat-value { font-family: var(--rt-font-display); font-size: 24px; font-weight: 700; color: var(--rt-petroleo); }
.stat-card .stat-info .stat-label { font-size: 12px; color: #888; margin-top: 2px; }
.stat-card.red-alert .stat-info .stat-value { color: var(--rt-rojo); }
.stat-card.red-alert .stat-info .stat-label { color: var(--rt-rojo); }
.stat-card.red-alert { border-color: #fecaca; }

/* Filters */
.filters-bar { background: var(--rt-surface); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); border: 1px solid var(--rt-borde); display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group label { font-size: 11px; font-weight: 600; color: #555; text-transform: uppercase; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.filter-group label i { color: var(--rt-teal); }
.filter-group select, .filter-group input { padding: 8px 12px; border: 1px solid var(--rt-borde-input); border-radius: 8px; font-size: 13px; background: #f9fafb; min-width: 140px; font-family: var(--rt-font-body); }
.filter-group select:focus, .filter-group input:focus { outline: none; border-color: var(--rt-teal); }
.filter-actions { margin-left: auto; display: flex; gap: 8px; }
.btn-filter { padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s; font-family: var(--rt-font-body); }
.btn-filter.primary { background: var(--rt-teal); color: #fff; border: none; }
.btn-filter.primary:hover { background: var(--rt-teal-dark); }
.btn-filter.secondary { background: #fff; color: #555; border: 1px solid #ddd; }
.btn-filter.secondary:hover { background: #f5f5f5; }

/* Table */
.table-section { background: var(--rt-surface); border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); border: 1px solid var(--rt-borde); overflow: hidden; }
.table-header-bar { padding: 14px 20px; border-bottom: 1px solid var(--rt-borde); font-size: 13px; color: var(--rt-texto-suave); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--rt-petroleo); }
thead th { padding: 12px 16px; color: #fff; font-size: 12px; font-weight: 500; text-align: left; text-transform: uppercase; letter-spacing: 0.3px; font-family: var(--rt-font-display); }
tbody tr { border-bottom: 1px solid #f0f0f0; transition: background 0.15s; }
tbody tr:hover { background: #f0faf8; }
tbody td { padding: 12px 16px; font-size: 13px; color: var(--rt-texto); vertical-align: middle; }
.mono { font-family: 'Courier New', monospace; background: #f0f4f4; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; color: var(--rt-petroleo); }

/* Doc icons & actions */
.doc-icons { display: flex; gap: 4px; align-items: center; }
.doc-icon-pill { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.doc-icon-pill.active { background: var(--rt-teal-tint); color: var(--rt-teal); }
.doc-icon-pill.inactive { background: #f5f5f5; opacity: 0.4; color: var(--rt-texto-tenue); }
.actions-cell { display: flex; gap: 5px; }
.btn-action { width: 32px; height: 32px; border-radius: 8px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: all 0.2s; }
.btn-action.view { background: var(--rt-teal-tint); color: var(--rt-teal); }
.btn-action.view:hover { background: var(--rt-teal); color: #fff; }
.btn-action.send { background: var(--rt-navy-tint); color: var(--rt-navy); }
.btn-action.send:hover { background: var(--rt-navy); color: #fff; }
.btn-action.edit { background: var(--rt-dorado-tint); color: var(--rt-oliva); }
.btn-action.edit:hover { background: var(--rt-dorado); color: var(--rt-petroleo); }
.btn-action.delete { background: var(--rt-rojo-tint); color: var(--rt-rojo); }
.btn-action.delete:hover { background: var(--rt-rojo); color: #fff; }
.badge-user { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; background: var(--rt-teal-tint); color: var(--rt-teal); }

/* Buttons */
.btn-primary { background: var(--rt-teal); color: #fff; border: none; padding: 10px 20px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 7px; font-family: var(--rt-font-body); }
.btn-primary:hover { background: var(--rt-teal-dark); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(32,153,150,0.3); }
.btn-secondary { background: #fff; color: var(--rt-petroleo); border: 1px solid #ddd; padding: 10px 20px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 7px; font-family: var(--rt-font-body); }
.btn-secondary:hover { background: #f5f5f5; border-color: #bbb; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-danger { background: var(--rt-rojo); color: #fff; border: none; padding: 8px 14px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.btn-danger:hover { background: #c82333; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.3s; backdrop-filter: blur(2px); }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: #fff; border-radius: 14px; width: 90%; max-width: 700px; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2); transform: scale(0.95); transition: transform 0.3s; }
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--rt-borde); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-family: var(--rt-font-display); color: var(--rt-petroleo); font-size: 17px; font-weight: 600; }
.modal-close { width: 32px; height: 32px; border-radius: 8px; border: none; background: #f0f0f0; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: #ddd; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--rt-borde); display: flex; justify-content: flex-end; gap: 10px; }

/* Legajo detail */
.legajo-view { display: none; }
.legajo-view.active { display: block; }
.tabs { display: flex; gap: 4px; background: var(--rt-bg); padding: 4px; border-radius: 10px; margin-bottom: 20px; width: fit-content; }
.tab { padding: 10px 20px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--rt-texto-suave); border-radius: 8px; transition: all 0.2s; display: flex; align-items: center; gap: 6px; }
.tab.active { background: #fff; color: var(--rt-petroleo); box-shadow: 0 1px 3px rgba(0,0,0,0.1); font-weight: 600; }
.tab:hover { color: var(--rt-petroleo); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-field { background: #f9fafb; padding: 14px 16px; border-radius: 8px; border: 1px solid var(--rt-borde); }
.detail-field label { font-size: 11px; color: #888; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; display: block; margin-bottom: 4px; }
.detail-field .value { font-size: 15px; color: var(--rt-petroleo); font-weight: 500; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--rt-teal); font-size: 13px; cursor: pointer; margin-bottom: 16px; font-weight: 500; padding: 6px 12px; border-radius: 6px; transition: background 0.2s; }
.back-btn:hover { background: var(--rt-teal-tint); }

/* Documents */
.doc-section { margin-bottom: 16px; border: 1px solid var(--rt-borde); border-radius: 10px; overflow: hidden; }
.doc-section-header { background: #f9fafb; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--rt-borde); }
.doc-section-header h4 { font-size: 14px; color: var(--rt-petroleo); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.doc-list { padding: 12px 18px; }
.doc-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f5f5f5; }
.doc-item:last-child { border-bottom: none; }
.doc-item-info { display: flex; align-items: center; gap: 12px; }
.doc-item-info .file-icon { width: 36px; height: 36px; background: var(--rt-rojo-tint); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--rt-rojo); font-size: 16px; }
.doc-item-info .filename { font-size: 13px; font-weight: 500; color: var(--rt-texto); }
.doc-item-info .meta { font-size: 11px; color: var(--rt-texto-tenue); margin-top: 2px; }
.doc-item-actions { display: flex; gap: 6px; }

/* Timeline */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 0; bottom: 0; width: 2px; background: #e8e8e8; }
.timeline-item { position: relative; margin-bottom: 14px; padding: 14px 18px; background: #fff; border-radius: 10px; border: 1px solid var(--rt-borde); }
.timeline-item::before { content: ''; position: absolute; left: -24px; top: 18px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; }
.timeline-item.create::before { background: var(--rt-teal); box-shadow: 0 0 0 2px var(--rt-teal); }
.timeline-item.edit::before { background: var(--rt-dorado); box-shadow: 0 0 0 2px var(--rt-dorado); }
.timeline-item.upload::before { background: var(--rt-navy); box-shadow: 0 0 0 2px var(--rt-navy); }
.timeline-item.delete::before { background: var(--rt-rojo); box-shadow: 0 0 0 2px var(--rt-rojo); }
.timeline-item .tl-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.timeline-item .tl-action { font-size: 13px; font-weight: 600; color: var(--rt-petroleo); display: flex; align-items: center; gap: 6px; }
.timeline-item .tl-date { font-size: 11px; color: var(--rt-texto-tenue); }
.timeline-item .tl-user { font-size: 12px; color: var(--rt-teal); font-weight: 500; }
.timeline-item .tl-detail { font-size: 12px; color: var(--rt-texto-suave); margin-top: 4px; }

/* Admin panel */
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.user-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
.user-table th { background: var(--rt-petroleo); color: #fff; padding: 12px 16px; font-size: 12px; text-align: left; font-family: var(--rt-font-display); }
.user-table td { padding: 12px 16px; border-bottom: 1px solid var(--rt-borde); font-size: 13px; }
.user-table tr:hover { background: #f0faf8; }
.role-badge { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.role-badge.admin { background: var(--rt-dorado-tint); color: var(--rt-oliva); }
.role-badge.basico { background: var(--rt-teal-tint); color: var(--rt-teal); }

/* Footer */
.app-footer { text-align: center; padding: 20px; font-size: 12px; color: var(--rt-texto-tenue); border-top: 1px solid var(--rt-borde); margin-top: 40px; }
@media (max-width: 1024px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) {
    .login-container { flex-direction: column; } .login-left { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .detail-grid { grid-template-columns: 1fr; }
}
