/* ==========================================================================
   SISTEMA DE DISEÑO DINÁMICO POR EMPRENDIMIENTO - CONTROL QR PRO
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* PALETA 1: TECH / SOFTWARE (POR DEFECTO) */
:root, [data-theme="tech"] {
    --bg-dark: #070b14;
    --bg-surface: rgba(15, 23, 42, 0.88);
    --bg-card: #0f172a;
    --primary: #0ea5e9;
    --primary-glow: rgba(14, 165, 233, 0.35);
    --accent: #38bdf8;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(56, 189, 248, 0.25);
}

/* PALETA 2: ESTÉTICA / BOUTIQUE (DORADO Y NEGRO) */
[data-theme="luxury"] {
    --bg-dark: #0a0908;
    --bg-surface: rgba(24, 21, 18, 0.92);
    --bg-card: #161310;
    --primary: #d4af37;
    --primary-glow: rgba(212, 175, 55, 0.35);
    --accent: #f3e5ab;
    --text-main: #ffffff;
    --text-muted: #bdb3a3;
    --border-color: rgba(212, 175, 55, 0.3);
}

/* PALETA 3: AGRO / JARDINERÍA (ESMERALDA) */
[data-theme="eco"] {
    --bg-dark: #07110a;
    --bg-surface: rgba(14, 28, 18, 0.9);
    --bg-card: #0e1d12;
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.35);
    --accent: #6ee7b7;
    --text-main: #f0fdf4;
    --text-muted: #9ca3af;
    --border-color: rgba(16, 185, 129, 0.3);
}

/* PALETA 4: TALLER / EBANISTERÍA / INDUSTRIAL (ÁMBAR) */
[data-theme="industrial"] {
    --bg-dark: #0f0c0a;
    --bg-surface: rgba(28, 22, 19, 0.92);
    --bg-card: #1c1613;
    --primary: #f59e0b;
    --primary-glow: rgba(245, 158, 11, 0.35);
    --accent: #fbbf24;
    --text-main: #fffbeb;
    --text-muted: #a8a29e;
    --border-color: rgba(245, 158, 11, 0.3);
}

/* PALETA 5: CORPORATIVO / SALUD (CARMESÍ) */
[data-theme="corporate"] {
    --bg-dark: #110709;
    --bg-surface: rgba(28, 14, 18, 0.92);
    --bg-card: #1d0e12;
    --primary: #f43f5e;
    --primary-glow: rgba(244, 63, 94, 0.35);
    --accent: #fda4af;
    --text-main: #fff1f2;
    --text-muted: #cbd5e1;
    --border-color: rgba(244, 63, 94, 0.3);
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 15%, var(--primary-glow), transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(255, 255, 255, 0.03), transparent 40%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.4s ease;
}

.container {
    width: 92%;
    max-width: 1280px;
    margin: 0 auto;
}

.hidden { display: none !important; }

/* ==========================================================================
   BARRA DE NAVEGACIÓN
   ========================================================================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-surface);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 4%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 2rem;
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.brand-main {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 1.5px;
    color: var(--text-main);
}

.brand-sub {
    display: block;
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.theme-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
}

.theme-switcher i { color: var(--primary); }

.theme-switcher select {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.theme-switcher select option {
    background: #111;
    color: #fff;
}

.btn-nav-primary {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 15px var(--primary-glow);
    transition: transform 0.2s ease;
}

.btn-nav-primary:hover { transform: translateY(-2px); }

.btn-nav-admin {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 9px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-nav-admin.unlocked {
    border-color: #22c55e;
    color: #4ade80;
    background: rgba(34, 197, 94, 0.12);
}

/* ==========================================================================
   CABECERA Y ESTADÍSTICAS
   ========================================================================== */
.main-wrapper { flex: 1; padding: 30px 0 60px; }

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 28px;
}

.system-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--primary);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.header-info h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.3rem);
    font-weight: 800;
    margin-bottom: 6px;
}

.header-info p {
    color: var(--text-muted);
    font-size: 0.92rem;
    max-width: 600px;
}

.stats-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 14px 20px;
    border-radius: 12px;
    min-width: 125px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.35rem;
    color: var(--text-main);
}

.text-accent { color: var(--primary); }
.text-success { color: #22c55e; }

/* ==========================================================================
   BARRA DE BÚSQUEDA Y FILTROS
   ========================================================================== */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    background: var(--bg-card);
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.search-box {
    flex: 1;
    min-width: 260px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.35);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.search-box i { color: var(--primary); }

.search-box input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.88rem;
    outline: none;
}

.status-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip.active, .filter-chip:hover {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}

/* ==========================================================================
   GRILLA DE PROYECTOS ACTIVOS
   ========================================================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    position: relative;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 15px var(--primary-glow);
    border-color: var(--primary);
}

.card-thumb {
    width: 100%;
    height: 170px;
    background: #05080f;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-thumb-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.card-thumb-placeholder i {
    font-size: 2.5rem;
    color: var(--primary);
    opacity: 0.6;
}

.qr-badge-float {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--primary);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 800;
}

.status-badge-float {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.status-sin-iniciar { background: #334155; color: #f8fafc; }
.status-en-proceso { background: #0284c7; color: #ffffff; }
.status-en-revision { background: #7c3aed; color: #ffffff; }
.status-pausado { background: #d97706; color: #ffffff; }
.status-finalizado { background: #16a34a; color: #ffffff; }

.card-body {
    padding: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-title {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--text-main);
}

.card-date {
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 600;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.card-footer-btn {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
    transition: background 0.2s ease;
}

.project-card:hover .card-footer-btn {
    background: var(--primary);
    color: #000;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: 16px;
}

.empty-state i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 12px;
}

/* ==========================================================================
   MODALES Y FORMULARIOS
   ========================================================================== */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.modal-backdrop.active { display: flex; }

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 16px;
    width: 100%;
    max-width: 620px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-sm { max-width: 400px; padding: 24px; }
.modal-detail { max-width: 680px; }

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-sm .modal-header { padding: 0 0 14px 0; }

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.7rem;
    cursor: pointer;
}

.modal-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 14px 0;
}

#projectForm {
    padding: 20px 22px;
    overflow-y: auto;
}

.form-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.flex-1 { flex: 1; min-width: 160px; }
.flex-2 { flex: 2; min-width: 240px; }

.form-group {
    margin-bottom: 16px;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 13px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
}

.form-group select option { background: #111; color: #fff; }

.field-hint {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.image-preview-box img {
    max-height: 110px;
    border-radius: 8px;
    margin-top: 8px;
    border: 1px solid var(--primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.w-100 { width: 100%; }

.btn-primary {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

/* ==========================================================================
   DETALLE DEL PROYECTO (VISTA ESCANEO MÓVIL Y PC)
   ========================================================================== */
.detail-badge-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qr-pill {
    font-family: 'Orbitron', sans-serif;
    background: var(--primary);
    color: #000;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.85rem;
}

.status-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 800;
}

.detail-scroll-body {
    padding: 20px 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-image-container {
    width: 100%;
    max-height: 280px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #05080f;
}

.detail-image-container img {
    width: 100%;
    height: 100%;
    max-height: 280px;
    object-fit: contain;
    display: block;
}

.detail-info-block h2 {
    font-size: 1.45rem;
    margin-bottom: 6px;
}

.detail-meta {
    font-size: 0.88rem;
    color: var(--accent);
    margin-bottom: 14px;
}

.quick-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 14px;
}

.quick-status-bar label {
    font-size: 0.85rem;
    font-weight: 700;
}

.quick-status-bar select {
    padding: 7px 12px;
    border-radius: 6px;
    background: #000;
    color: #fff;
    border: 1px solid var(--primary);
    font-weight: 700;
}

.detail-description-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-description-box h4 {
    font-size: 0.82rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.detail-description-box p {
    font-size: 0.92rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

/* GENERADOR DE CÓDIGO QR REUTILIZABLE */
.qr-card-generator {
    display: flex;
    align-items: center;
    gap: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed var(--primary);
    padding: 16px;
    border-radius: 12px;
    flex-wrap: wrap;
}

.qr-visual-box {
    background: #ffffff;
    padding: 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-instructions { flex: 1; min-width: 200px; }
.qr-instructions h4 { font-size: 0.95rem; color: var(--accent); margin-bottom: 4px; }
.qr-instructions p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 12px; }

.qr-btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-outline-sm {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--text-main);
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-outline-sm:hover {
    background: var(--primary);
    color: #000;
}

/* PANEL DE EXPORTACIÓN Y COMPARTIR */
.share-export-panel h4 {
    font-size: 0.88rem;
    margin-bottom: 10px;
    color: var(--accent);
}

.share-grid-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.btn-share {
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-ws { background: #25d366; color: #000; }
.btn-ws-dark { background: #128c7e; }
.btn-mail { background: #2563eb; }
.btn-pdf { background: #dc2626; }

.detail-footer-actions {
    padding: 14px 22px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
}

.btn-action-edit {
    flex: 1;
    padding: 11px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
}

.btn-action-delete {
    flex: 1;
    padding: 11px;
    background: rgba(220, 38, 38, 0.18);
    border: 1px solid #ef4444;
    color: #fca5a5;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
}

.btn-action-delete:hover {
    background: #dc2626;
    color: #fff;
}

/* FOOTER */
.app-footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.app-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

@media (max-width: 640px) {
    .navbar { padding: 10px 14px; }
    .detail-footer-actions { flex-direction: column; }
}