/* =========================================================
   AU MARKETING COMMAND CENTER v6.6 - ESTILOS FINALES
   (Incluye Fix de Alta Densidad para muchas tareas)
   ========================================================= */

:root {
    /* Identidad */
    --au-gold: #EEB617;
    --au-dark: #0a0a0a;
    --au-panel: #141414;
    --au-border: #333333;
    --text-main: #e0e0e0;
    --text-muted: #999999;
    
    /* Estados */
    --st-todo: #888; 
    --st-prog: #EEB617;
    --st-done: #28a745;
    --st-post: #e67e22;
    --st-canc: #e74c3c;

    /* Redes */
    --net-insta: #E1306C; --net-face: #1877F2; --net-link: #0077b5;
    --net-web: #EEB617; --net-ads: #28a745; --net-yt: #FF0000; --net-google: #4285F4;
    --net-event: #9b59b6; --net-gen: #ecf0f1;
}

/* 1. LAYOUT PRINCIPAL */
#au-app-wrapper {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw; height: 100vh;
    background-color: var(--au-dark);
    z-index: 999999; 
    display: flex; flex-direction: column;
    padding: 25px; box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    font-size: 14px;
    overflow: hidden; 
}

#au-app-wrapper * { box-sizing: border-box; }
#au-app-wrapper button { cursor: pointer; font-family: inherit; }

/* Scrollbars Globales */
#au-app-wrapper ::-webkit-scrollbar { width: 8px; height: 8px; }
#au-app-wrapper ::-webkit-scrollbar-track { background: #111; }
#au-app-wrapper ::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
#au-app-wrapper ::-webkit-scrollbar-thumb:hover { background: var(--au-gold); }

/* 2. HEADER */
.au-header {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 20px; border-bottom: 1px solid var(--au-border);
    margin-bottom: 25px; flex-shrink: 0;
}
.au-brand { display: flex; align-items: center; gap: 15px; }
.au-logo-text { font-family: 'Outfit', sans-serif; font-size: 24px; color: var(--au-gold); font-weight: 800; letter-spacing: 1px; user-select: none; }
.au-subtitle { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 2px; }

.au-controls { display: flex; gap: 12px; align-items: center; }

/* PANEL ADMIN OCULTO */
#adminPanel {
    display: none; 
    align-items: center;
}
.au-btn-text-danger {
    background: transparent; border: 1px solid #e74c3c; color: #e74c3c;
    padding: 5px 15px; border-radius: 20px; font-size: 11px; font-weight: 700;
    transition: 0.2s; text-transform: uppercase; margin-right: 5px;
}
.au-btn-text-danger:hover { background: #e74c3c; color: #fff; }

/* Botones Icono */
#au-app-wrapper .au-btn-icon {
    background: #1f1f1f; border: 1px solid #333; color: #aaa;
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; margin: 0; transition: 0.2s;
}
#au-app-wrapper .au-btn-icon:hover { color: var(--au-gold); border-color: var(--au-gold); }

/* Botón Historial */
#au-app-wrapper .au-btn-text {
    background: transparent; border: 1px solid #333; color: #ccc;
    padding: 0 25px; height: 40px; border-radius: 40px;
    font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px;
}
#au-app-wrapper .au-btn-text:hover { background: var(--au-gold); color: #000; border-color: var(--au-gold); font-weight: 700; }

/* Botón Upload Blindado */
.au-upload-wrapper { position: relative !important; width: 40px !important; height: 40px !important; display: inline-block !important; }
.au-upload-label {
    position: absolute !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important;
    background: #1f1f1f !important; border: 1px solid #333 !important; color: #aaa !important; border-radius: 10px !important;
    display: flex !important; align-items: center !important; justify-content: center !important; cursor: pointer !important;
}
.au-file-input { 
    position: absolute !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; opacity: 0 !important; cursor: pointer !important;
}
.au-upload-label:hover { border-color: var(--au-gold) !important; color: var(--au-gold) !important; }

/* Navegación */
.au-nav-pills { display: flex; background: #1f1f1f; padding: 4px; border-radius: 50px; border: 1px solid #333; }
.au-pill { padding: 8px 25px; border-radius: 40px; cursor: pointer; color: #666; transition: 0.3s; }
.au-pill.active { background: var(--au-gold); color: #000; }

/* 3. ESTRUCTURA */
.au-view { display: none; height: 100%; width: 100%; }
.au-view.active { display: block; animation: fadeIn 0.4s; }
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }

.au-main-grid { display: grid; grid-template-columns: 3fr 1fr; gap: 25px; height: calc(100vh - 130px); }

.au-calendar-card, .au-sidebar-card, .au-card {
    background: var(--au-panel); border: 1px solid var(--au-border); border-radius: 16px;
    padding: 25px; display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.chart-container { position: relative; height: 250px; width: 100%; }

/* 4. CALENDARIO (CORREGIDO PARA ALTA DENSIDAD) */
.au-cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.au-cal-header h2 { font-family: 'Outfit'; font-size: 22px; color: #fff; letter-spacing: 0.5px; }
.au-month-nav button { background: transparent; border: 1px solid #444; color: #fff; width: 32px; height: 32px; border-radius: 50%; margin-left: 8px; transition:0.2s; }
.au-month-nav button:hover { border-color: var(--au-gold); color: var(--au-gold); }
.au-btn-today { background: transparent; border: 1px solid #EEB617; color: #EEB617; border-radius: 20px; padding: 5px 15px; font-weight: 700; width: auto !important; margin-right: 10px; font-size: 11px; }

.au-days-header { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; color: var(--au-gold); font-weight: 700; font-size: 11px; padding-bottom: 10px; border-bottom: 1px solid #333; margin-bottom: 10px; letter-spacing: 1px; }
.au-days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; flex-grow: 1; overflow-y: auto; padding-right: 5px; }

/* --- AQUÍ ESTÁ EL CAMBIO VISUAL IMPORTANTE --- */
.au-day-cell {
    background: rgba(255,255,255,0.02); 
    border: 1px solid var(--au-border); 
    border-radius: 8px;
    padding: 6px; 
    height: 140px; /* Altura Fija */
    overflow-y: auto; /* Scroll si hay muchas tareas */
    cursor: pointer; 
    transition: 0.2s;
    display: flex; flex-direction: column; gap: 3px;
    scrollbar-width: thin; scrollbar-color: #444 transparent;
}
.au-day-cell:hover { background: rgba(238, 182, 23, 0.05); border-color: rgba(238,182,23,0.4); }
.selected-day { background: rgba(238, 182, 23, 0.1) !important; border: 1px solid var(--au-gold) !important; box-shadow: inset 0 0 15px rgba(238,182,23,0.1); }
.au-day-cell.holiday { background: rgba(231, 76, 60, 0.05); border-color: rgba(231, 76, 60, 0.3); }
.au-day-cell.empty { background: transparent; border: none; cursor: default; }

.au-day-num { 
    font-weight: 700; font-size: 12px; color: #fff; opacity: 0.9; margin-bottom: 5px; 
    position: sticky; top: 0; background: var(--au-panel); z-index: 10; padding-bottom: 2px; border-bottom: 1px solid #222;
    display: flex; justify-content: space-between;
}
.au-holiday-tag { font-size: 8px; color: #e74c3c; background: rgba(231,76,60,0.1); padding: 2px 4px; border-radius: 3px; font-weight: 700; }

.au-task-pill {
    display: block; font-size: 10px; padding: 2px 6px; border-radius: 4px;
    background: #252525; border-left: 3px solid #555; color: #ccc;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 1px; flex-shrink: 0; transition: 0.2s;
}
.au-task-pill:hover { transform: translateX(2px); color: #fff; background: #333; z-index: 5; }

/* Colores Pills */
.au-task-pill.instagram { border-color: var(--net-insta); background: rgba(225, 48, 108, 0.1); }
.au-task-pill.facebook { border-color: var(--net-face); background: rgba(24, 119, 242, 0.1); }
.au-task-pill.web { border-color: var(--net-web); background: rgba(238, 182, 23, 0.1); }
.au-task-pill.ads { border-color: var(--net-ads); background: rgba(40, 167, 69, 0.1); }
.au-task-pill.youtube { border-color: var(--net-yt); background: rgba(255, 0, 0, 0.1); }
.au-task-pill.google { border-color: var(--net-google); background: rgba(66, 133, 244, 0.1); }
.au-task-pill.event { border-color: var(--net-event); background: rgba(155, 89, 182, 0.1); }
.au-task-pill.done { opacity: 0.4; text-decoration: line-through; }
.au-task-pill.canceled { opacity: 0.5; text-decoration: line-through; border-color: var(--st-canc); color: var(--st-canc); }

.au-task-dot { display: none; }

/* 5. SIDEBAR */
.au-sidebar-card { padding: 0; background: transparent; border: none; box-shadow: none; }
#sidebarList { height: 100%; overflow-y: auto; padding-right: 8px; }

.au-btn-add-day {
    width: 100%; background: rgba(238,182,23,0.1); border: 1px dashed var(--au-gold);
    color: var(--au-gold); padding: 15px; border-radius: 12px; margin-bottom: 20px;
    font-weight: 700; transition: 0.2s; text-transform: uppercase; font-size: 12px;
}
.au-btn-add-day:hover { background: var(--au-gold); color: #000; }

.au-task-item {
    background: var(--au-panel); border: 1px solid var(--au-border); border-radius: 12px;
    padding: 15px; margin-bottom: 12px; border-left: 4px solid #555;
    cursor: pointer; display: flex; align-items: center; gap: 15px; transition: 0.2s;
}
.au-task-item:hover { transform: translateX(4px); background: #222; border-color: #444; }

.au-icon-box {
    width: 42px; height: 42px; border-radius: 10px; background: rgba(255,255,255,0.04);
    display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}

.au-info { flex-grow: 1; overflow: hidden; display: flex; flex-direction: column; }
.au-meta { font-size: 11px; color: #888; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; }
.au-title { font-weight: 500; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.au-status-badge { 
    font-size: 9px; padding: 2px 6px; border-radius: 4px; 
    font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
}
.st-badge-todo { background: #333; color: #bbb; border: 1px solid #555; }
.st-badge-prog { background: rgba(238, 182, 23, 0.15); color: #EEB617; border: 1px solid #EEB617; }
.st-badge-done { background: rgba(40, 167, 69, 0.15); color: #28a745; border: 1px solid #28a745; }
.st-badge-post { background: rgba(230, 126, 34, 0.15); color: #e67e22; border: 1px solid #e67e22; }
.st-badge-canc { background: rgba(231, 76, 60, 0.15); color: #e74c3c; border: 1px solid #e74c3c; text-decoration: line-through; }

/* 6. MODAL */
.au-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.92); backdrop-filter: blur(8px); z-index: 1000000;
    display:flex; justify-content:center; align-items:center;
}
.au-modal-box {
    background: #181818; width: 600px; max-width: 95%; border-radius: 16px;
    padding: 30px; border: 1px solid var(--au-gold); box-shadow: 0 0 60px rgba(238, 182, 23, 0.1);
    max-height: 90vh; overflow-y: auto; position: relative;
}
.au-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; border-bottom: 1px solid #333; padding-bottom: 15px; }
.au-btn-close { background: none; border: none; color: #666; font-size: 24px; cursor: pointer; }

#au-app-wrapper label, #au-app-wrapper .au-label, #au-app-wrapper .au-label-highlight {
    display: block !important; font-size: 11px !important; color: #EEB617 !important; margin-bottom: 8px !important; text-transform: uppercase !important; font-weight: 700 !important;
}
#au-app-wrapper form .au-input {
    width: 100% !important; background-color: #050505 !important; border: 1px solid #444 !important; color: #ffffff !important; padding: 12px 15px !important; border-radius: 8px !important; font-size: 14px !important; height: auto !important; box-shadow: none !important; margin: 0 !important;
}
#au-app-wrapper form .au-input:focus { border-color: var(--au-gold) !important; outline: none !important; }

.au-group { margin-bottom: 20px; }
.au-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 10px; }

.au-network-selector { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 25px; }
.au-net-opt { width: 50px; height: 50px; border-radius: 12px; background: #222; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 22px; color: #666; transition: 0.2s; border: 2px solid transparent; }
.au-net-opt:hover { background: #333; color: #fff; transform: translateY(-3px); }
.au-net-opt.selected { background: #000; border-color: var(--au-gold); color: #fff; box-shadow: 0 5px 15px rgba(238,182,23,0.2); }

.au-status-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
#au-app-wrapper .au-st-btn { padding: 10px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; font-size: 10px; font-weight: 700; text-transform: uppercase; opacity: 0.4; transition: 0.2s; width: 100%; }
.au-st-btn.active { opacity: 1; transform: scale(1.05); }
.st-todo.active { background: #444; color: #fff; border-color: #fff; }
.st-prog.active { background: var(--st-prog-bg); border-color: var(--au-gold); color: var(--au-gold); }
.st-done.active { background: var(--st-done-bg); border-color: var(--st-done); color: var(--st-done); }
.st-post.active { background: var(--st-post-bg); border-color: var(--st-post); color: var(--st-post); }
.st-cancel.active { background: var(--st-canc-bg); border-color: var(--st-canc); color: var(--st-canc); }

.conditional-field { display: none; }
.conditional-field.active { display: block; animation: fadeIn 0.3s; }

.au-footer-actions { display: flex; gap: 15px; margin-top: 30px; border-top: 1px solid #222; padding-top: 20px; }
#au-app-wrapper .au-btn-save { flex: 2; background: var(--au-gold); border: none; padding: 15px; font-weight: 800; border-radius: 10px; color: #000; letter-spacing: 1px; }
#au-app-wrapper .au-btn-dup { flex: 1; background: #3498db; border: none; color: #fff; border-radius: 10px; font-weight: 600; }
#au-app-wrapper .au-btn-del { flex: 1; background: #222; border: 1px solid #444; color: #e74c3c; border-radius: 10px; }

/* 7. MÓVIL */
@media (max-width: 768px) {
    #au-app-wrapper { padding: 10px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .au-main-grid { display: flex; flex-direction: column; height: auto; overflow: visible; }
    .au-header { flex-direction: column; gap: 15px; align-items: flex-start; margin-bottom: 15px; }
    .au-controls { width: 100%; justify-content: space-between; overflow-x: auto; padding-bottom: 5px; }
    .au-logo-text { font-size: 20px; }
    .au-calendar-card { min-height: auto; padding: 15px; margin-bottom: 20px; }
    
    /* En móvil, volvemos a la vista simple con puntitos */
    .au-day-cell { min-height: 60px; height: auto; justify-content: flex-start; overflow-y: visible; }
    .au-task-pill { display: none; }
    .au-dots-container { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
    .au-task-dot { width: 6px; height: 6px; border-radius: 50%; background: #555; display: block; }
    .au-task-dot.instagram { background: var(--net-insta); }
    .au-task-dot.facebook { background: var(--net-face); }
    .au-task-dot.web { background: var(--net-web); }
    .au-task-dot.ads { background: var(--net-ads); }
    .au-task-dot.youtube { background: var(--net-yt); }
    .au-task-dot.google { background: var(--net-google); }
    .au-task-dot.event { background: var(--net-event); }
    
    .au-sidebar-card { display: block !important; height: auto; overflow: visible; padding-bottom: 50px; }
    .au-modal-box { width: 100%; height: 100%; max-height: 100vh; border-radius: 0; border: none; display: flex; flex-direction: column; padding: 20px; }
    .au-footer-actions { margin-top: auto; }
    .au-status-grid { grid-template-columns: 1fr 1fr; }
}