/**
 * @file assets/css/protopage.css
 * @description Estilos personalizados para el Gestor de Enlaces estilo Protopage.
 *              Incluye soporte para modo escritorio (posicionamiento libre, drag & drop, redimensionamiento)
 *              y modo responsive para móvil y tablet.
 * @author Tu Gestor de Enlaces
 * @license MIT
 */

:root {
    --header-height: 54px;
    --search-height: 52px;
    --tabs-height: 48px;
    --glass-bg: rgba(22, 28, 36, 0.88);
    --glass-border: rgba(255, 255, 255, 0.14);
}

/* Base y fondo general con viewport fijado para navegación y scrollbar en el área de escritorio */
html, body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #f1f5f9;
    background-color: #0b0f19 !important;
}

/* Estructura general de la aplicación */
.app-layout {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Contenedor de la barra superior: fijo siempre al ancho del viewport (100% de la ventana) */
.app-top-nav {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100vw;
    z-index: 1030;
    overflow: visible;
    box-sizing: border-box;
    position: relative;
}

/* Contenedor con scroll propio horizontal y vertical del escritorio de widgets */
.desktop-scroll-area {
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: auto;
    width: 100%;
    height: 100%;
    position: relative;
    box-sizing: border-box;
    scrollbar-color: rgba(255, 255, 255, 0.25) rgba(15, 23, 42, 0.7);
    scrollbar-width: thin;
}

/* Capa de fondo fija acelerada por GPU para evitar parpadeos al añadir widgets o cambiar pestañas */
.desktop-fixed-wallpaper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -9999;
    pointer-events: none;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    transform: translate3d(0, 0, 0);
    will-change: transform;
    backface-visibility: hidden;
}

/* Barra superior principal (Branding y acciones) */
.protopage-header {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    position: relative;
    z-index: 100;
    width: 100%;
    box-sizing: border-box;
}

.protopage-header .dropdown {
    position: relative;
}

.protopage-header .dropdown-menu {
    z-index: 1050 !important;
}

.brand-badge {
    background: #0284c7;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
    text-decoration: none;
}
.brand-badge:hover {
    color: #ffffff;
    opacity: 0.95;
}

/* Barra de Búsqueda Multibuscador */
.search-strip {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    position: relative;
    z-index: 20;
}

.search-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-input-box {
    flex: 1 1 300px;
    position: relative;
}

.search-input-box input {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 6px;
    padding: 0.45rem 0.85rem;
    width: 100%;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.search-input-box input:focus {
    outline: none;
    background: rgba(30, 41, 59, 1);
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.search-providers-list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.provider-chip {
    background: rgba(51, 65, 85, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    padding: 0.3rem 0.65rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
    user-select: none;
    text-decoration: none;
}

.provider-chip:hover {
    background: rgba(71, 85, 105, 0.9);
    color: #ffffff;
}

.provider-chip.active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
    font-weight: 600;
}

.provider-chip img, .provider-chip svg {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
    vertical-align: middle;
    display: inline-block;
}

/* Barra de Pestañas (Tabs) */
.tabs-bar-container {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    padding: 0.4rem 1rem 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 10;
    overflow-x: auto;
}

.tabs-list {
    display: flex;
    align-items: flex-end;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
}

.protopage-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px 8px 0 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    border-bottom: none;
    position: relative;
    text-decoration: none;
}

.protopage-tab:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.protopage-tab.active {
    box-shadow: 0 -3px 8px rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.3);
    z-index: 2;
}

.search-submit-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.25rem 0.4rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, transform 0.15s ease;
}
.search-submit-btn:hover {
    color: #38bdf8;
    transform: translateY(-50%) scale(1.1);
}

.tab-action-btn {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0.9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
}
.tab-action-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.55);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.tab-action-btn.tab-delete-btn:hover {
    background: rgba(220, 38, 38, 0.85);
    border-color: rgba(239, 68, 68, 0.9);
}

.new-tab-btn {
    background: rgba(71, 85, 105, 0.6);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    color: #cbd5e1;
    border-radius: 8px 8px 0 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}
.new-tab-btn:hover {
    background: rgba(100, 116, 139, 0.8);
    color: #ffffff;
}

/* Lienzo de Escritorio (Desktop Canvas) con soporte de expansión dinámica horizontal y vertical */
.desktop-workspace {
    position: relative;
    min-height: 100%;
    min-width: 100%;
    width: max-content;
    height: max-content;
    padding: 1.5rem;
    box-sizing: border-box;
}

/* Widgets */
.protopage-widget {
    background-color: var(--glass-bg);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
    user-select: none;
    min-width: 180px;
}

/* Altura mínima reducida para widgets de enlaces: 78px permite ver perfectamente la cabecera y 1 enlace */
.protopage-widget.widget-type-bookmarks {
    min-height: 78px;
}
.protopage-widget.widget-type-bookmarks .widget-body {
    padding: 0.35rem 0.65rem;
}
.protopage-widget.widget-type-bookmarks .bookmarks-list {
    padding-right: 14px;
}

/* Destaque sutil al crear un nuevo widget en el centro del escritorio */
.protopage-widget.widget-newly-created {
    animation: widgetCreatedPulse 1.4s ease-out;
    z-index: 999 !important;
}

@keyframes widgetCreatedPulse {
    0% {
        transform: scale(0.96);
        box-shadow: 0 0 0 4px #38bdf8, 0 16px 40px rgba(56, 189, 248, 0.6);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 6px #38bdf8, 0 20px 48px rgba(56, 189, 248, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    }
}

/* En móvil muy estrecho (< 576px): flujo vertical */
@media (max-width: 575px) {
    body {
        width: 100% !important;
        min-width: 100% !important;
    }
    .desktop-workspace {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
        padding: 0.75rem;
        width: 100% !important;
        min-width: 100% !important;
        min-height: auto !important;
    }
    .protopage-widget {
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
    }
}

.protopage-widget:hover {
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

.protopage-widget.is-dragging {
    z-index: 9999 !important;
    cursor: grabbing !important;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.75) !important;
}

/* Cabecera del Widget (Siempre 100% sólida y opaca, no afectada por transparencia del fondo) */
.widget-header {
    padding: 0.45rem 0.75rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    border-top-left-radius: 11px;
    border-top-right-radius: 11px;
    opacity: 1 !important;
}

.widget-title-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.widget-actions {
    display: flex;
    align-items: center;
    gap: 0.18rem;
    font-size: 0.78rem;
}

.widget-action-link {
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    padding: 0.15rem 0.25rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    line-height: 1;
}

.widget-action-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.22);
}

.widget-action-link.btn-edit-widget i,
.widget-action-link.btn-delete-widget i {
    font-size: 0.76rem;
}

.widget-action-link.btn-delete-widget:hover {
    color: #ffffff;
    background: rgba(220, 38, 38, 0.65);
}

.widget-collapse-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    padding: 0.15rem 0.25rem;
    line-height: 1;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.9;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, opacity 0.15s ease;
}
.widget-collapse-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* Cuerpo del Widget */
.widget-body {
    padding: 0.65rem 0.75rem;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 100%;
    container-type: inline-size;
    container-name: widgetbody;
}

.protopage-widget.collapsed .widget-body,
.protopage-widget.collapsed .widget-resizer {
    display: none !important;
}

.protopage-widget.collapsed {
    height: auto !important;
    min-height: unset !important;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.protopage-widget.collapsed .widget-header {
    border-radius: 11px;
}

.protopage-tab.drag-target-hover {
    box-shadow: 0 0 0 3px #38bdf8, 0 0 16px rgba(56, 189, 248, 0.8) !important;
    transform: scale(1.08) translateY(-4px) !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    z-index: 100;
}

/* Lista de Marcadores / Enlaces: adaptable en columnas al ancho del widget */
.bookmarks-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: block;
    columns: 1;
    column-gap: 1.5rem;
    width: 100%;
}

@container widgetbody (min-width: 350px) {
    .bookmarks-list {
        columns: 2;
    }
}

@container widgetbody (min-width: 560px) {
    .bookmarks-list {
        columns: 3;
    }
}

@container widgetbody (min-width: 780px) {
    .bookmarks-list {
        columns: 4;
    }
}

@container widgetbody (min-width: 1000px) {
    .bookmarks-list {
        columns: 5;
    }
}

/* Clases explícitas para soporte total garantizado en cualquier navegador/estado */
.protopage-widget[data-columns="1"] .bookmarks-list {
    columns: 1 !important;
}
.protopage-widget[data-columns="2"] .bookmarks-list {
    columns: 2 !important;
}
.protopage-widget[data-columns="3"] .bookmarks-list {
    columns: 3 !important;
}
.protopage-widget[data-columns="4"] .bookmarks-list {
    columns: 4 !important;
}
.protopage-widget[data-columns="5"] .bookmarks-list {
    columns: 5 !important;
}

.bookmarks-list > li {
    display: block;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 0.15rem;
    width: 100%;
}

/* Arrastre interactivo de enlaces entre widgets */
.bookmark-li {
    cursor: grab;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.bookmark-li:active {
    cursor: grabbing;
}

.bookmark-li.is-dragging {
    opacity: 0.35 !important;
    transform: scale(0.97);
}

/* Indicadores visuales de inserción al reordenar */
.bookmark-li.drag-over-above {
    position: relative;
}
.bookmark-li.drag-over-above::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: #38bdf8;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
    pointer-events: none;
    z-index: 10;
}

.bookmark-li.drag-over-below {
    position: relative;
}
.bookmark-li.drag-over-below::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: #38bdf8;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
    pointer-events: none;
    z-index: 10;
}

/* Filas editables en el modal */
.bookmark-edit-row {
    transition: background-color 0.15s ease;
}
.bookmark-edit-row.is-dragging {
    opacity: 0.35;
    background: rgba(56, 189, 248, 0.15) !important;
}
.bookmark-edit-row.drag-over-above td {
    border-top: 2px solid #38bdf8 !important;
}
.bookmark-edit-row.drag-over-below td {
    border-bottom: 2px solid #38bdf8 !important;
}
.drag-handle-btn {
    cursor: grab;
    user-select: none;
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 1;
}
.drag-handle-btn:active {
    cursor: grabbing;
}

.protopage-widget.drag-bookmark-target {
    outline: 2px dashed #38bdf8 !important;
    outline-offset: -2px;
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.45) !important;
    transition: outline 0.15s ease, box-shadow 0.15s ease;
}

.protopage-widget.drag-bookmark-target .widget-header {
    filter: brightness(1.15);
}

.bookmark-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0;
    border-radius: 4px;
    color: #f1f5f9;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.25;
    transition: all 0.15s ease;
    cursor: pointer;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

.bookmark-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(2px);
}

.bookmark-icon {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    object-fit: contain;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
}

.bookmark-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    text-decoration: underline;
    text-underline-offset: 2.5px;
    text-decoration-color: rgba(255, 255, 255, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.bookmark-item:hover .bookmark-title {
    text-decoration-color: #ffffff;
}

/* Asa de redimensionamiento estilo Protopage */
.widget-resizer {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    opacity: 0.65;
    z-index: 25;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 2px;
    transition: opacity 0.15s ease, transform 0.15s ease;
    user-select: none;
    touch-action: none;
}

.widget-resizer:hover {
    opacity: 1;
    transform: scale(1.15);
}

.widget-resizer::after {
    content: "";
    width: 10px;
    height: 10px;
    background: repeating-linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.85),
        rgba(255, 255, 255, 0.85) 1.5px,
        transparent 1.5px,
        transparent 3px
    );
    clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

/* Paleta de colores en modales */
.color-swatches-row {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}

.color-swatch-box {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-swatch-box:hover {
    transform: scale(1.15);
}

.color-swatch-box.selected {
    border-color: #ffffff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

/* Modales oscuros */
.modal-content.dark-modal {
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.dark-modal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-modal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-modal .form-control {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.dark-modal .form-control:focus {
    background: #0f172a;
    border-color: #38bdf8;
    color: #ffffff;
}

/* Modales secundarios/de confirmación apilados sobre Gestión de Usuarios */
#modalConfirmToggleRole,
#modalConfirmBlockUser,
#modalConfirmDeleteUser,
#modalResetUserPassword {
    z-index: 1070 !important;
}

/* Notificación flotante de confirmación (toast) */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1090;
}

/* Chips de preajuste de transparencia */
.trans-chip {
    transition: all 0.15s ease;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.trans-chip:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.4);
}

.trans-chip.active {
    background: #0284c7 !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(2, 132, 199, 0.5);
}

/* Widget de Imagen (Photo upload) */
.photo-icon-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
}

.image-widget-body {
    flex: 1 1 auto;
    position: relative;
    overflow: hidden;
}

.image-widget-display-container {
    height: calc(100% - 38px);
    overflow: auto;
}

.widget-display-image {
    display: block;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.photo-caption-text {
    font-size: 0.8rem;
    color: #e2e8f0;
    word-break: break-word;
}

.image-widget-setup {
    height: calc(100% - 38px);
    overflow-y: auto;
}

.image-widget-setup .dim-input:disabled,
#editImageWidgetModal .dim-input:disabled {
    opacity: 0.45;
    background-color: rgba(15, 23, 42, 0.5);
    color: #94a3b8;
}

/* Widget Web (Embedded Web Page) */
.protopage-widget.widget-type-web {
    overflow: hidden !important;
}

.protopage-widget.widget-type-web .widget-body {
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

.web-widget-body {
    flex: 1 1 auto;
    width: 100%;
    height: calc(100% - 38px);
    background-color: #ffffff;
    overflow: hidden !important;
    position: relative;
    padding: 0 !important;
    margin: 0 !important;
}

.web-iframe-viewport {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
}

.web-iframe-cropper {
    position: absolute;
    transform-origin: 0 0;
    overflow: hidden !important;
}

.web-widget-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background-color: #ffffff;
}

/* Widget Reloj (Analog Clock) */
.clock-widget-body {
    flex: 1 1 auto;
    width: 100%;
    height: calc(100% - 38px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

.clock-svg-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

.clock-svg {
    width: 100%;
    height: 100%;
    max-width: 280px;
    max-height: 280px;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
    user-select: none;
    display: block;
}

/* Skins del Reloj */
/* 1. Classic (Estación Suiza / Blanco) - Por defecto */
.clock-skin-classic .clock-bezel { fill: #475569; stroke: #334155; stroke-width: 2; }
.clock-skin-classic .clock-face { fill: #f8fafc; }
.clock-skin-classic .clock-tick-major { fill: #0f172a; }
.clock-skin-classic .clock-tick-minor { fill: #334155; }
.clock-skin-classic .clock-hand-hour { fill: #0f172a; stroke: #000000; stroke-width: 0.5; }
.clock-skin-classic .clock-hand-minute { fill: #0f172a; stroke: #000000; stroke-width: 0.5; }
.clock-skin-classic .clock-hand-second { stroke: #dc2626; stroke-width: 1.8; stroke-linecap: round; }
.clock-skin-classic .clock-cap-center { fill: #dc2626; stroke: #b91c1c; stroke-width: 0.75; }

/* 2. Dark (Minimalista Oscuro Slate & Cyan) */
.clock-skin-dark .clock-bezel { fill: #1e293b; stroke: #334155; stroke-width: 2; }
.clock-skin-dark .clock-face { fill: #0f172a; }
.clock-skin-dark .clock-tick-major { fill: #38bdf8; }
.clock-skin-dark .clock-tick-minor { fill: #64748b; }
.clock-skin-dark .clock-hand-hour { fill: #f1f5f9; stroke: #94a3b8; stroke-width: 0.5; }
.clock-skin-dark .clock-hand-minute { fill: #f1f5f9; stroke: #94a3b8; stroke-width: 0.5; }
.clock-skin-dark .clock-hand-second { stroke: #06b6d4; stroke-width: 1.8; stroke-linecap: round; }
.clock-skin-dark .clock-cap-center { fill: #06b6d4; stroke: #0891b2; stroke-width: 0.75; }

/* 3. Gold (Oro Clásico / Champagne) */
.clock-skin-gold .clock-bezel { fill: #92400e; stroke: #d97706; stroke-width: 2; }
.clock-skin-gold .clock-face { fill: #fefce8; }
.clock-skin-gold .clock-tick-major { fill: #78350f; }
.clock-skin-gold .clock-tick-minor { fill: #b45309; }
.clock-skin-gold .clock-hand-hour { fill: #78350f; stroke: #451a03; stroke-width: 0.5; }
.clock-skin-gold .clock-hand-minute { fill: #78350f; stroke: #451a03; stroke-width: 0.5; }
.clock-skin-gold .clock-hand-second { stroke: #d97706; stroke-width: 1.8; stroke-linecap: round; }
.clock-skin-gold .clock-cap-center { fill: #d97706; stroke: #b45309; stroke-width: 0.75; }

/* 4. Navy (Azul Medianoche / Royal) */
.clock-skin-navy .clock-bezel { fill: #0f172a; stroke: #312e81; stroke-width: 2; }
.clock-skin-navy .clock-face { fill: #1e1b4b; }
.clock-skin-navy .clock-tick-major { fill: #93c5fd; }
.clock-skin-navy .clock-tick-minor { fill: #6366f1; }
.clock-skin-navy .clock-hand-hour { fill: #ffffff; stroke: #cbd5e1; stroke-width: 0.5; }
.clock-skin-navy .clock-hand-minute { fill: #ffffff; stroke: #cbd5e1; stroke-width: 0.5; }
.clock-skin-navy .clock-hand-second { stroke: #38bdf8; stroke-width: 1.8; stroke-linecap: round; }
.clock-skin-navy .clock-cap-center { fill: #38bdf8; stroke: #0284c7; stroke-width: 0.75; }

/* 5. Vintage (Sepia & Nogal) */
.clock-skin-vintage .clock-bezel { fill: #5c3a21; stroke: #78350f; stroke-width: 2; }
.clock-skin-vintage .clock-face { fill: #fef3c7; }
.clock-skin-vintage .clock-tick-major { fill: #451a03; }
.clock-skin-vintage .clock-tick-minor { fill: #92400e; }
.clock-skin-vintage .clock-hand-hour { fill: #292524; stroke: #1c1917; stroke-width: 0.5; }
.clock-skin-vintage .clock-hand-minute { fill: #292524; stroke: #1c1917; stroke-width: 0.5; }
.clock-skin-vintage .clock-hand-second { stroke: #991b1b; stroke-width: 1.8; stroke-linecap: round; }
.clock-skin-vintage .clock-cap-center { fill: #991b1b; stroke: #7f1d1d; stroke-width: 0.75; }

/* 6. Neon (Ciberpunk Black & Emerald) */
.clock-skin-neon .clock-bezel { fill: #18181b; stroke: #059669; stroke-width: 2; }
.clock-skin-neon .clock-face { fill: #000000; }
.clock-skin-neon .clock-tick-major { fill: #10b981; }
.clock-skin-neon .clock-tick-minor { fill: #047857; }
.clock-skin-neon .clock-hand-hour { fill: #34d399; stroke: #059669; stroke-width: 0.5; }
.clock-skin-neon .clock-hand-minute { fill: #34d399; stroke: #059669; stroke-width: 0.5; }
.clock-skin-neon .clock-hand-second { stroke: #6ee7b7; stroke-width: 1.8; stroke-linecap: round; }
.clock-skin-neon .clock-cap-center { fill: #6ee7b7; stroke: #10b981; stroke-width: 0.75; }

/* Ventana de fecha (Día del mes estilo reloj de pulsera) */
.clock-date-window {
    user-select: none;
    pointer-events: none;
}
.clock-date-frame {
    stroke-width: 1.2;
}
.clock-date-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Colores de la ventana de fecha según el skin */
.clock-skin-classic .clock-date-frame { fill: #ffffff; stroke: #94a3b8; }
.clock-skin-classic .clock-date-text { fill: #0f172a; }

.clock-skin-dark .clock-date-frame { fill: #1e293b; stroke: #475569; }
.clock-skin-dark .clock-date-text { fill: #38bdf8; }

.clock-skin-gold .clock-date-frame { fill: #fffbeb; stroke: #d97706; }
.clock-skin-gold .clock-date-text { fill: #78350f; }

.clock-skin-navy .clock-date-frame { fill: #1e1b4b; stroke: #6366f1; }
.clock-skin-navy .clock-date-text { fill: #ffffff; }

.clock-skin-vintage .clock-date-frame { fill: #fef3c7; stroke: #92400e; }
.clock-skin-vintage .clock-date-text { fill: #451a03; }

.clock-skin-neon .clock-date-frame { fill: #18181b; stroke: #10b981; }
.clock-skin-neon .clock-date-text { fill: #34d399; }

/* ==========================================================================
   WIDGET CALENDARIO (Calendar Widget)
   ========================================================================== */
.calendar-widget-body {
    user-select: none;
    display: flex;
    flex-direction: column;
    padding: 8px 10px 10px 10px;
    height: calc(100% - 38px);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.calendar-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 6px 4px;
}

.calendar-nav-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background-color 0.15s ease, opacity 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
}

.calendar-nav-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    opacity: 1;
}

.calendar-month-year-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.3px;
    transition: opacity 0.15s ease;
}

.calendar-month-year-title:hover {
    opacity: 0.8;
}

.calendar-weekdays-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.calendar-cell-weekday {
    color: #f1f5f9;
}

.calendar-cell-weekend {
    color: #8da49f;
    opacity: 0.75;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px 2px;
    text-align: center;
    padding-top: 6px;
    align-items: center;
    flex-grow: 1;
}

.calendar-day-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    border-radius: 6px;
    transition: transform 0.1s ease, background-color 0.15s ease;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.calendar-day-cell.calendar-cell-weekend:not(.calendar-cell-today) {
    color: #8da49f;
    opacity: 0.75;
}

.calendar-day-cell:hover:not(.calendar-day-empty):not(.calendar-cell-today) {
    background: rgba(255, 255, 255, 0.14);
}

.calendar-day-cell.calendar-cell-today {
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
}

/* Círculo que marca los días con nota o recordatorio */
.calendar-day-cell.calendar-has-note::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    border: 2px solid var(--note-color, #5eead4);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 6px var(--note-color, #5eead4);
    z-index: 2;
}

.calendar-day-cell.calendar-cell-today.calendar-has-note::after {
    width: 27px;
    height: 27px;
    border: 2.5px solid var(--note-color, #5eead4);
    box-shadow: 0 0 8px var(--note-color, #5eead4), inset 0 0 4px rgba(255, 255, 255, 0.4);
}

.calendar-day-empty {
    visibility: hidden;
    pointer-events: none;
    cursor: default;
}

/* Popover interactivo para editar notas en el calendario */
.calendar-note-popover {
    position: fixed;
    z-index: 1060;
    width: 285px;
    background: rgba(22, 42, 38, 0.96);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65), 0 0 1px rgba(255, 255, 255, 0.3);
    padding: 10px 12px;
    color: #ffffff;
    animation: calPopoverFadeIn 0.15s ease-out;
}

@keyframes calPopoverFadeIn {
    from { opacity: 0; transform: translateY(-4px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.calendar-popover-title {
    font-size: 0.82rem;
    color: #f1f5f9;
    letter-spacing: 0.2px;
}

.calendar-note-popover input,
.calendar-note-popover textarea {
    background-color: rgba(15, 23, 42, 0.7) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    font-size: 0.84rem;
}

.calendar-note-popover input:focus,
.calendar-note-popover textarea:focus {
    border-color: #5eead4 !important;
    box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.3) !important;
}

/* Selector de 5 colores para la nota en el popover */
.note-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.35);
    display: inline-block;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.note-color-swatch:hover {
    transform: scale(1.18);
    border-color: #ffffff;
}

.note-color-swatch.selected {
    transform: scale(1.22);
    border-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4), 0 0 8px rgba(255, 255, 255, 0.8);
}

/* Tooltip al pasar el ratón por un día marcado */
.calendar-hover-tooltip {
    position: fixed;
    z-index: 1070;
    max-width: 260px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(94, 234, 212, 0.5);
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
    padding: 6px 10px;
    pointer-events: none;
    animation: calTooltipFadeIn 0.12s ease-out;
}

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

.calendar-tooltip-date {
    font-size: 0.72rem;
    color: #5eead4;
    text-transform: capitalize;
}

.calendar-tooltip-text {
    font-size: 0.82rem;
    line-height: 1.35;
    word-break: break-word;
    white-space: pre-wrap;
    max-height: 180px;
    overflow-y: auto;
}

/* ==========================================================================
   WIDGET DE NOTAS (Rich Text Note Widget)
   ========================================================================== */

.note-toolbar-row {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: none;
    user-select: none;
}

.note-toolbar-btn {
    width: 32px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #64748b;
    border-radius: 2.5px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
    padding: 0;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.note-toolbar-btn:hover {
    background-color: #f1f5f9;
    border-color: #334155;
}

.note-toolbar-btn:active {
    background-color: #e2e8f0;
    transform: translateY(1px);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.note-rich-text-editor {
    min-height: 230px;
    max-height: 380px;
    overflow-y: auto;
    background: rgba(22, 42, 38, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 14px;
    color: #ffffff;
    font-size: 0.92rem;
    line-height: 1.55;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.note-rich-text-editor:focus {
    border-color: #5eead4 !important;
    box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.3) !important;
}

/* Estilos de contenido enriquecido tanto en el editor como en el widget */
.note-rich-text-editor p,
.protopage-note-display-content p {
    margin-bottom: 0.5rem;
}

.note-rich-text-editor p:last-child,
.protopage-note-display-content p:last-child {
    margin-bottom: 0;
}

.note-rich-text-editor ul,
.protopage-note-display-content ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 0.6rem;
}

.note-rich-text-editor ol,
.protopage-note-display-content ol {
    list-style-type: decimal;
    padding-left: 1.5rem;
    margin-bottom: 0.6rem;
}

.note-rich-text-editor li,
.protopage-note-display-content li {
    margin-bottom: 0.25rem;
}

.note-rich-text-editor hr,
.protopage-note-display-content hr {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    margin: 0.8rem 0;
}

.note-rich-text-editor a,
.protopage-note-display-content a {
    color: #38bdf8;
    text-decoration: underline;
    transition: color 0.15s ease;
}

.note-rich-text-editor a:hover,
.protopage-note-display-content a:hover {
    color: #7dd3fc;
}

.note-rich-text-editor blockquote,
.protopage-note-display-content blockquote {
    border-left: 3px solid #5eead4;
    padding-left: 0.75rem;
    margin-left: 0;
    color: #cbd5e1;
    font-style: italic;
}

.protopage-note-display-content {
    font-size: 0.92rem;
    line-height: 1.5;
    color: #ffffff;
    word-break: break-word;
}

/* ==========================================================================
   WIDGET TAREAS (TODO / TASKS WIDGET - IDÉNTICO A SCREENSHOT 1 Y 2)
   ========================================================================== */

.tasks-widget-body {
    padding: 0;
    user-select: none;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Lista de tareas */
.tasks-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

/* Fila individual de tarea */
.task-item-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    transition: background-color 0.15s ease, opacity 0.2s ease, transform 0.2s ease;
    gap: 8px;
    position: relative;
    cursor: grab;
}

.task-item-row:active {
    cursor: grabbing;
}

.task-item-row:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.task-item-row.is-dragging {
    opacity: 0.35;
    background-color: rgba(56, 189, 248, 0.12) !important;
    cursor: grabbing;
}

.task-item-row.drag-over-above {
    border-top: 2px solid #38bdf8 !important;
}

.task-item-row.drag-over-below {
    border-bottom: 2px solid #38bdf8 !important;
}

/* Columna del checkbox */
.task-checkbox-col {
    display: flex;
    align-items: center;
    padding-top: 2px;
    flex-shrink: 0;
}

/* Checkbox estilizado moderno, limpio y alineado */
.task-checkbox-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0;
    user-select: none;
}

.task-checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.task-checkbox-custom {
    width: 15px;
    height: 15px;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 3px;
    background-color: rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease-in-out;
}

.task-checkbox-custom i {
    font-size: 13px;
    color: #ffffff;
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.15s ease-in-out;
    line-height: 1;
}

.task-checkbox-wrapper:hover .task-checkbox-custom {
    border-color: #38bdf8;
    background-color: rgba(56, 189, 248, 0.15);
}

.task-checkbox-wrapper input[type="checkbox"]:checked ~ .task-checkbox-custom {
    background-color: #10b981;
    border-color: #10b981;
}

.task-checkbox-wrapper input[type="checkbox"]:checked ~ .task-checkbox-custom i {
    opacity: 1;
    transform: scale(1);
}

/* Columna de texto */
.task-text-col {
    flex-grow: 1;
    min-width: 0;
    padding-left: 2px;
    padding-right: 4px;
}

.task-text {
    font-size: 0.90rem;
    font-weight: 500;
    color: #f8fafc;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    cursor: pointer;
    transition: color 0.15s ease, opacity 0.15s ease;
    user-select: text;
}

.task-text:hover {
    color: #ffffff;
}

/* Tarea completada: tachado exacto y elegante */
.task-text.completed {
    text-decoration: line-through;
    opacity: 0.52;
    color: #94a3b8;
}

/* Columna y botón de eliminar tarea (papelera/basura) */
.task-actions-col {
    display: flex;
    align-items: center;
    padding-top: 1px;
    flex-shrink: 0;
}

.task-delete-btn {
    background: transparent;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.45);
    padding: 2px 4px;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.task-delete-btn:hover {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.18);
    transform: scale(1.1);
}

/* Editor inline para escribir nueva tarea (idéntico a image2_2f681c04.png) */
.task-inline-editor-container {
    padding: 8px 12px;
}

.task-inline-box {
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    border-radius: 6px;
    background: rgba(10, 20, 18, 0.65);
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.task-inline-box:focus-within {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.task-inline-input,
.task-inline-textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 0.90rem;
    line-height: 1.35;
    padding: 0;
    font-family: inherit;
    user-select: text;
}

.task-inline-input::placeholder,
.task-inline-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.task-inline-discard-btn {
    background: transparent;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.55);
    padding: 2px 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.task-inline-discard-btn:hover {
    color: #ef4444;
}

/* Input para edición inline directa de una tarea existente */
.task-inline-edit-input,
.task-inline-edit-textarea {
    width: 100%;
    background: rgba(10, 20, 18, 0.85);
    border: 1.5px solid #38bdf8;
    border-radius: 5px;
    color: #ffffff;
    font-size: 0.90rem;
    line-height: 1.35;
    padding: 4px 8px;
    outline: none;
    font-family: inherit;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
    user-select: text;
}

/* Footer "+ Nueva tarea" (idéntico a "+ new item" en image_0b7f8807.png) */
.task-add-footer {
    padding: 6px 12px 10px 12px;
}

.task-add-btn {
    background: transparent;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.task-add-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}








