/* =========================
   VARIABLES GLOBALES
   ========================= */
:root {
    --bg-main: #0e0e0e;
    --bg-dark: #141414;
    --bg-panel: #1a1a1a;
    --bg-card: #ffffff;

    --sidebar-bg: #161616;

    --primary: #3498db;
    --success: #2ecc71;
    --warning: #f1c40f;
    --danger: #e74c3c;

    --text-main: #ecf0f1;
    --text-muted: #7f8c8d;

    --border-soft: #2a2a2a;
    --shadow-soft: 0 10px 25px rgba(0,0,0,0.6);
}

/* =========================
   BASE
   ========================= */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    display: flex;
    overflow: hidden;
}

/* =========================
   SIDEBAR
   ========================= */
.sidebar {
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #161616, #101010);
    padding: 20px 0;
    box-shadow: 4px 0 20px rgba(0,0,0,0.6);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    color: var(--primary);
    text-align: center;
    margin: 0;
}

.sidebar small {
    display: block;
    text-align: center;
    color: #555;
    margin-bottom: 30px;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 14px 25px;
    transition: all 0.25s ease;
    border-left: 4px solid transparent;
    font-size: 0.95rem;
}

.sidebar li a:hover {
    background: #1f1f1f;
    color: white;
}

.sidebar li a.active {
    background: #1f1f1f;
    color: white;
    border-left-color: var(--primary);
}

/* =========================
   MAIN
   ========================= */
main {
    flex: 1;
    padding: 20px;
    overflow: hidden;
}

/* =========================
   PLANO DE PLANTA
   ========================= */
#plano {
    width: 100%;
    height: calc(100vh - 140px);
    background-color: #0f1720;
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    border-radius: 22px;
    border: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
}

/* =========================
   TELARES (CARDS)
   ========================= */
.telar-card {
    width: 130px;
    height: 110px;
    position: absolute;
    background: var(--bg-card);
    color: #222;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 10;
    border-bottom: 6px solid #bbb;
}

.telar-card:hover {
    transform: scale(1.06);
    box-shadow: 0 15px 35px rgba(0,0,0,0.7);
}

.telar-card.active {
    border-bottom-color: var(--success);
}

.telar-card.suspended {
    border-bottom-color: var(--warning);
    opacity: 0.75;
}

.telar-card strong {
    font-size: 1rem;
}

.telar-card small {
    font-size: 0.7rem;
    color: #666;
}

/* Punto de estado */
.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-bottom: 6px;
}

.active .status-dot {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.suspended .status-dot {
    background: var(--warning);
    box-shadow: 0 0 10px var(--warning);
}

/* =========================
   MENÚ LATERAL TELAR
   ========================= */
.menu-lateral {
    position: fixed;
    right: -420px;
    top: 0;
    width: 400px;
    height: 100%;
    background: linear-gradient(180deg, #1a1a1a, #111);
    padding: 30px;
    transition: right 0.45s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: -15px 0 40px rgba(0,0,0,0.9);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-soft);
}

.menu-lateral.open {
    right: 0;
}

/* Botón cerrar */
.btn-cerrar-x {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #333;
    color: white;
    font-size: 22px;
    cursor: pointer;
    transition: background 0.25s;
}

.btn-cerrar-x:hover {
    background: var(--danger);
}

/* =========================
   BOTONES GRANDES
   ========================= */
.btn-grande {
    width: 100%;
    padding: 18px;
    margin: 8px 0;
    border-radius: 14px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-grande:active {
    transform: scale(0.97);
}

.btn-analisis {
    background: linear-gradient(135deg, #8e44ad, #5e3370);
}

.btn-produccion {
    background: linear-gradient(135deg, var(--primary), #21618c);
}

.btn-gastos {
    background: linear-gradient(135deg, #e67e22, #b35400);
}

/* =========================
   BOTÓN FLOTANTE
   ========================= */
.btn-flotante-add {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 70px;
    height: 70px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    border: none;
    font-size: 36px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(46, 204, 113, 0.5);
    z-index: 500;
    transition: transform 0.25s ease;
}

.btn-flotante-add:hover {
    transform: rotate(90deg) scale(1.1);
}

/* =========================
   MODALES
   ========================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    backdrop-filter: blur(6px);
}

.modal-content,
.modal-content-wide {
    background: var(--bg-panel);
    border-radius: 22px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

/* =========================
   TABLAS
   ========================= */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-size: 0.75rem;
    color: #666;
    padding: 10px;
}

td {
    padding: 10px;
    font-size: 0.85rem;
}

/* =========================
   INPUTS
   ========================= */
input {
    background: #000;
    border: 1px solid #333;
    color: white;
    padding: 12px;
    border-radius: 8px;
    outline: none;
}

input:focus {
    border-color: var(--primary);
}

/* =========================
   SCROLL PERSONALIZADO
   ========================= */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #111;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#notifications {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.notification {
  padding: 12px 16px;
  margin-bottom: 10px;
  border-radius: 6px;
  color: #fff;
  min-width: 260px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.success { background: #2ecc71; }
.error { background: #e74c3c; }
.warning { background: #f39c12; }
