/* style.css - Portal de Auditorías de Calidad */
:root {
    --bg-main: #0a0e1a;
    --bg-sidebar: #0f1526;
    --bg-card: rgba(19, 27, 49, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --primary: #10b981; /* Esmeralda */
    --primary-glow: rgba(16, 185, 129, 0.15);
    --accent: #3b82f6; /* Azul */
    --accent-glow: rgba(59, 130, 246, 0.15);
    --orange: #f97316;
    --red: #ef4444;
}

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

body {
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Layout Grid */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: white;
}

.logo-area h2 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-btn.active {
    color: white;
    background-color: var(--accent-glow);
    border-left: 3px solid var(--accent);
    padding-left: 13px;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-badge {
    display: inline-block;
    margin-top: 8px;
    color: var(--primary);
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    padding: 40px;
    overflow-y: auto;
    max-height: 100vh;
}

.top-header {
    margin-bottom: 32px;
}

.top-header h1 {
    font-size: 1.85rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.top-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Tab Management */
.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Card Styling */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
}

.card-header {
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
}

/* Form Styles */
.form-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
    margin-bottom: 24px;
}

.form-section:last-of-type {
    border-bottom: none;
}

.section-title {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    margin-bottom: 16px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.form-grid.full-grid {
    grid-template-columns: 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

/* Forzar que las opciones del select tengan fondo oscuro en navegadores basados en Chromium */
.form-group select option,
select option {
    background-color: #111827;
    color: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 10px var(--accent-glow);
}

.form-group input[readonly] {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    cursor: not-allowed;
}

.input-with-action {
    display: flex;
    align-items: center;
    position: relative;
}

.input-with-action input {
    width: 100%;
}

.loader-inline {
    position: absolute;
    right: 12px;
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.metadata-banner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 16px;
    padding: 12px 16px;
    background-color: var(--accent-glow);
    border-left: 4px solid var(--accent);
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Checklist grid */
.checklist-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.checklist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.chk-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chk-label strong {
    font-size: 0.9rem;
    color: var(--text-main);
}

.chk-label span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chk-options select {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    color: white;
    font-family: inherit;
    font-weight: 600;
}

/* Submit Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.submit-btn {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 32px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    transition: all 0.2s ease;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

/* Alert Styling */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert.success {
    background-color: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--primary);
    color: var(--primary);
}

.alert.error {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--red);
    color: var(--red);
}

.alert.info {
    background-color: var(--accent-glow);
    border: 1px solid var(--accent);
    color: var(--accent);
}

.hidden {
    display: none !important;
}

/* Dashboard Cards and Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.kpi-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.text-emerald { color: var(--primary); }
.text-blue { color: var(--accent); }
.text-orange { color: var(--orange); }

.dashboard-grid-two {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 24px;
}

/* Criteria List (Dashboard progress bar metrics) */
.metric-row {
    margin-bottom: 16px;
}

.metric-row:last-child {
    margin-bottom: 0;
}

.metric-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.metric-name {
    font-weight: 600;
}

.metric-percentage {
    font-weight: 700;
}

.metric-bar-bg {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.1, 0.8, 0.25, 1);
}

.bg-primary { background: linear-gradient(90deg, var(--accent), var(--primary)); }
.bg-orange { background: var(--orange); }

/* Responsibility list metrics */
.resp-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background-color: rgba(255,255,255,0.01);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
}

.resp-item-info {
    display: flex;
    flex-direction: column;
}

.resp-item-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.resp-item-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.resp-item-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    background-color: rgba(255, 255, 255, 0.05);
}

/* Tables and filter card */
.filter-card {
    padding: 18px 24px;
}

.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

th, td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

/* Detailed List Search header */
.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-box input {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    color: white;
    font-family: inherit;
    font-size: 0.85rem;
    width: 260px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
}

.quality-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
}

.quality-badge.high {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--primary);
}

.quality-badge.mid {
    background-color: rgba(249, 115, 22, 0.15);
    color: var(--orange);
}

.quality-badge.low {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

/* Custom link buttons for tables */
.link-btn {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.link-btn:hover {
    color: white;
}

/* Autocomplete Suggestions Styles */
.relative-container {
    position: relative;
}

.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    margin-top: 4px;
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.suggestion-name {
    font-weight: 600;
    color: var(--text-main);
}

.suggestion-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.drop-zone.hover {
    border-color: var(--primary) !important;
    background: rgba(59, 130, 246, 0.08) !important;
}

.drop-zone:hover {
    border-color: rgba(255, 255, 255, 0.3) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

