@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* UI Pantalla Base */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
    -webkit-tap-highlight-color: transparent;
    /* Eliminar highlight azul en móviles */
    transition: background-color 0.3s, color 0.3s;
}

.tab-btn.active {
    border-bottom: 3px solid #2563eb;
    color: #2563eb;
    font-weight: 700;
    background-color: #eff6ff;
}

.drag-handle {
    cursor: grab;
    color: #9ca3af;
    padding: 5px;
}

/* Rich Text Editor Styles */
.rich-text-wrapper {
    transition: box-shadow 0.2s;
}

.rich-text-wrapper:focus-within {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
    /* Blue ring focus */
}

.ag-item-comment-editor:empty:before,
.ac-obs-editor:empty:before {
    content: attr(placeholder);
    color: #9ca3af;
    pointer-events: none;
    font-style: italic;
}

.toolbar button {
    transition: background-color 0.2s;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* List Styles in Rich Text */
.ag-item-comment-editor ul,
.ac-obs-editor ul,
.agenda-note-div ul,
.whitespace-pre-wrap ul {
    list-style-type: disc;
    margin-left: 1.5em;
}

.ag-item-comment-editor ol,
.ac-obs-editor ol,
.agenda-note-div ol,
.whitespace-pre-wrap ol {
    list-style-type: decimal;
    margin-left: 1.5em;
}

/* Enforce Rich Text Formats (Tailwind/Reset Override) */
.ag-item-comment-editor b,
.ag-item-comment-editor strong,
.ac-obs-editor b,
.ac-obs-editor strong,
.agenda-note-div b,
.agenda-note-div strong,
.whitespace-pre-wrap b,
.whitespace-pre-wrap strong {
    font-weight: bold !important;
}

.ag-item-comment-editor i,
.ag-item-comment-editor em,
.ac-obs-editor i,
.ac-obs-editor em,
.agenda-note-div i,
.agenda-note-div em,
.whitespace-pre-wrap i,
.whitespace-pre-wrap em {
    font-style: italic !important;
}

.ag-item-comment-editor u,
.ac-obs-editor u,
.agenda-note-div u,
.whitespace-pre-wrap u {
    text-decoration: underline !important;
}

/* Table Styles in Rich Text */
.ag-item-comment-editor table,
.ac-obs-editor table,
.agenda-note-div table,
.whitespace-pre-wrap table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.ag-item-comment-editor table td,
.ag-item-comment-editor table th,
.ac-obs-editor table td,
.ac-obs-editor table th,
.agenda-note-div table td,
.agenda-note-div table th,
.whitespace-pre-wrap table td,
.whitespace-pre-wrap table th {
    border: 1px solid #d1d5db;
    /* gray-300 */
    padding: 4px;
    vertical-align: top;
}

.dark .ag-item-comment-editor table td,
.dark .ag-item-comment-editor table th,
.dark .ac-obs-editor table td,
.dark .ac-obs-editor table th,
.dark .agenda-note-div table td,
.dark .agenda-note-div table th,
.dark .whitespace-pre-wrap table td,
.dark .whitespace-pre-wrap table th {
    border-color: #4b5563;
    /* gray-600 */
}

/* Ensure preview tables stick to black/white borders for printing if needed, usually gray is fine, but let's be safe for dark mode print exception */
.dark .printable-area table td,
.dark .printable-area table th {
    border-color: #d1d5db !important;
}

/* Floating Table Toolbar */
.table-bubble {
    position: absolute;
    z-index: 50;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 4px;
    display: flex;
    gap: 4px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    margin-top: -8px;
    transition: opacity 0.2s, transform 0.2s;
}

.dark .table-bubble {
    background: #1f2937;
    border-color: #374151;
}

.table-bubble button {
    padding: 4px 8px;
    border-radius: 4px;
    color: #4b5563;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.table-bubble button:hover {
    background-color: #f3f4f6;
}

.dark .table-bubble button {
    color: #9ca3af;
}

.dark .table-bubble button:hover {
    background-color: #374151;
}

.table-bubble button.delete-btn {
    color: #ef4444;
}

.table-bubble button.delete-btn:hover {
    background-color: #fee2e2;
}

.dark .table-bubble button.delete-btn:hover {
    background-color: #7f1d1d;
}

/* MODO NOCHE */
.dark body {
    background-color: #111827;
    color: #f3f4f6;
}

.dark .bg-white {
    background-color: #1f2937;
    color: #e5e7eb;
}

.dark .bg-gray-50,
.dark .bg-gray-100,
.dark .bg-gray-200 {
    background-color: #111827;
    border-color: #374151;
}

.dark .shadow,
.dark .shadow-sm {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.5);
}

.dark .text-gray-800,
.dark .text-gray-700,
.dark .text-gray-600 {
    color: #d1d5db;
}

.dark .text-blue-600 {
    color: #60a5fa;
}

.dark .text-emerald-600 {
    color: #34d399;
}

.dark input,
.dark textarea,
.dark select {
    background-color: #374151;
    border-color: #4b5563;
    color: #fff;
}

.dark input::placeholder,
.dark textarea::placeholder {
    color: #9ca3af;
}

.dark .tab-btn {
    background-color: #1f2937;
    color: #9ca3af;
}

.dark .tab-btn:hover {
    background-color: #374151;
}

.dark .tab-btn.active {
    background-color: #1e3a8a;
    color: #93c5fd;
    border-bottom-color: #3b82f6;
}

.dark .border,
.dark .border-t,
.dark .border-b {
    border-color: #374151;
}

/* EXCEPCIÓN: Vista Previa A4 siempre blanca */
.dark .printable-area,
.dark .printable-area * {
    background-color: white !important;
    color: black !important;
    border-color: #e5e7eb !important;
}

.dark .printable-area .text-gray-500,
.dark .printable-area .text-gray-500 * {
    color: #6b7280 !important;
}

.dark .printable-area .text-gray-600 {
    color: #4b5563 !important;
}

.dark .printable-area .text-blue-600 {
    color: #2563eb !important;
}

.dark .printable-area .text-emerald-900 {
    color: #064e3b !important;
}

.dark .printable-area .text-emerald-700 {
    color: #047857 !important;
}

.dark .printable-area .bg-emerald-50 {
    background-color: #ecfdf5 !important;
}

/* IMPRESIÓN A4 */
@media print {
    @page {
        size: A4;
        margin: 1cm;
    }

    body {
        margin: 0;
        padding: 0;
        background: white;
    }

    body * {
        visibility: hidden;
    }

    .printable-area,
    .printable-area * {
        visibility: visible;
    }

    .printable-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        background: white;
        box-shadow: none;
    }

    .no-print {
        display: none !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .avoid-break {
        page-break-inside: avoid;
    }
}

/* Vista Previa */
.a4-preview {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    background: white;
    padding: 1cm;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: none;
    /* No animaciones en hoja */
}

@media (max-width: 768px) {
    .a4-preview {
        width: 100%;
        min-height: auto;
        padding: 15px;
        transform: scale(1);
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}

/* Estilos Documento */
.doc-watermark-header {
    border-bottom: 1px solid #d1d5db;
    margin-bottom: 20px;
    padding-bottom: 5px;
    color: #9ca3af;
    font-size: 8pt;
    font-family: sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
}

.doc-main-title {
    font-size: 22pt;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    color: #111827;
    line-height: 1.2;
}

.info-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    margin: 20px 0;
    padding: 15px;
    border: 1px solid #e5e7eb;
    border-left: 5px solid #2563eb;
    border-radius: 4px;
}

.assignee-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 2px 8px;
    border-radius: 9999px;
    margin-left: 8px;
    text-transform: uppercase;
}

.time-tag {
    font-weight: 700;
    color: #2563eb;
    font-size: 0.9em;
    margin-left: auto;
    white-space: nowrap;
}

.time-tag-acta {
    font-weight: 400;
    color: #6b7280;
    font-size: 0.85em;
    margin-left: 8px;
    font-style: italic;
}