/* Estilos personalizados para o Notion Clone */

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Classes utilitárias */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Editor styles */
.ProseMirror {
    min-height: calc(100vh - 200px);
    padding: 2rem;
}

.ProseMirror:focus {
    outline: none;
}

.ProseMirror > * + * {
    margin-top: 0.75em;
}

.ProseMirror h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.ProseMirror h2 {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 1.3em;
    margin-bottom: 0.5em;
}

.ProseMirror h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    margin-top: 1.2em;
    margin-bottom: 0.5em;
}

.ProseMirror p {
    line-height: 1.6;
    margin-bottom: 0.5em;
}

.ProseMirror blockquote {
    border-left: 4px solid #d1d5db;
    padding-left: 1rem;
    font-style: italic;
    color: #4b5563;
    margin: 1.5em 0;
}

.ProseMirror pre {
    background: #f3f4f6;
    border-radius: 0.5rem;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    margin: 1.5em 0;
}

.ProseMirror code {
    background: #f3f4f6;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.ProseMirror ul:not([data-type="taskList"]),
.ProseMirror ol {
    padding-left: 1.5rem;
}

.ProseMirror ul:not([data-type="taskList"]) {
    list-style-type: disc;
}

.ProseMirror ol {
    list-style-type: decimal;
}

.ProseMirror li {
    margin: 0.25em 0;
}

/* Task list styling */
.ProseMirror ul[data-type="taskList"] {
    padding-left: 0;
    list-style: none;
}

.ProseMirror ul[data-type="taskList"] li {
    display: flex;
    align-items: flex-start;
    margin: 0.5em 0;
}

.ProseMirror ul[data-type="taskList"] li > label {
    flex: 0 0 auto;
    margin-right: 0.5rem;
    user-select: none;
}

.ProseMirror ul[data-type="taskList"] li > div {
    flex: 1 1 auto;
}

.ProseMirror ul[data-type="taskList"] li input[type="checkbox"] {
    cursor: pointer;
    width: 1.2em;
    height: 1.2em;
    margin-top: 0.3em;
}

.ProseMirror ul[data-type="taskList"] li[data-checked="true"] > div > p {
    text-decoration: line-through;
    color: #9ca3af;
}

/* Table styling */
.ProseMirror table {
    border-collapse: collapse;
    margin: 1em 0;
    width: 100%;
    overflow: hidden;
}

.ProseMirror th,
.ProseMirror td {
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    text-align: left;
    position: relative;
}

.ProseMirror th {
    background-color: #f3f4f6;
    font-weight: 600;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Responsividade */
@media (max-width: 768px) {
    .ProseMirror {
        padding: 1rem;
    }
    
    .ProseMirror h1 {
        font-size: 2rem;
    }
    
    .ProseMirror h2 {
        font-size: 1.75rem;
    }
    
    .ProseMirror h3 {
        font-size: 1.25rem;
    }
}

/* Estilo para links */
.ProseMirror a {
    color: #3b82f6;
    text-decoration: underline;
    text-decoration-color: #93c5fd;
}

.ProseMirror a:hover {
    color: #1d4ed8;
    text-decoration-color: #3b82f6;
}

/* Botão ativo no editor */
.tiptap-button.active {
    background-color: #e5e7eb !important;
    color: #374151 !important;
}

/* Transições suaves */
.transition-all {
    transition: all 0.2s ease-in-out;
}

/* Placeholder styling */
.ProseMirror p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    color: #9ca3af;
    pointer-events: none;
    height: 0;
}

/* Loading states */
.loading {
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Dark mode support */
.dark .ProseMirror {
    background-color: #1f2937;
    color: #f9fafb;
}

.dark .ProseMirror pre {
    background-color: #374151;
}

.dark .ProseMirror code {
    background-color: #374151;
}

.dark .ProseMirror blockquote {
    border-left-color: #4b5563;
    color: #d1d5db;
}

.dark .ProseMirror table th {
    background-color: #374151;
}

.dark .ProseMirror table td,
.dark .ProseMirror table th {
    border-color: #4b5563;
}

/* Card hover effects */
.hover-lift:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
}

/* Tag styling */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.tag-blue {
    background-color: #dbeafe;
    color: #1e40af;
}

.tag-green {
    background-color: #d1fae5;
    color: #065f46;
}

.tag-purple {
    background-color: #f3e8ff;
    color: #6b21a8;
}

.tag-red {
    background-color: #fee2e2;
    color: #991b1b;
}

.tag-yellow {
    background-color: #fef3c7;
    color: #92400e;
}

/* Empty state styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    background-color: #f3f4f6;
    color: #9ca3af;
}

.dark .empty-state-icon {
    background-color: #374151;
    color: #6b7280;
}

/* Estilos específicos para template de POP */
.sop-template {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
}

.sop-template h1 {
    color: #2c3e50;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 30px;
    text-align: center;
}

.sop-template h2 {
    color: #2980b9;
    border-left: 4px solid #3498db;
    padding-left: 10px;
    margin-top: 40px;
    margin-bottom: 20px;
}

.sop-template h3 {
    color: #16a085;
    margin-top: 25px;
    margin-bottom: 15px;
}

.sop-header {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 30px;
}

.sop-header table {
    width: 100%;
    border-collapse: collapse;
}

.sop-header td {
    padding: 8px 15px;
    border: 1px solid #dee2e6;
    vertical-align: top;
}

.sop-header td:nth-child(odd) {
    background-color: #e9ecef;
    font-weight: bold;
    width: 20%;
}

.sop-template table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.95em;
}

.sop-template th {
    background-color: #3498db;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
}

.sop-template td {
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    vertical-align: top;
}

.sop-template table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.sop-template table tbody tr:hover {
    background-color: #e8f4fc;
}

.flowchart {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 20px;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    overflow-x: auto;
}

.sop-footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 2px dashed #ccc;
}

.sop-footer .warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
    text-align: center;
    font-weight: bold;
}

/* Checkboxes no POP */
.sop-template ul[data-type="taskList"] {
    padding-left: 0;
    list-style: none;
}

.sop-template ul[data-type="taskList"] li {
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
}

.sop-template ul[data-type="taskList"] li:last-child {
    border-bottom: none;
}

.sop-template ul[data-type="taskList"] input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

/* Responsividade para tabelas POP */
@media (max-width: 768px) {
    .sop-template table {
        display: block;
        overflow-x: auto;
    }
    
    .sop-header td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    
    .sop-header td:nth-child(odd) {
        width: 100%;
        margin-top: 10px;
    }
}

/* Ícones específicos para POP */
.pop-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: #3498db;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    margin-right: 8px;
    font-size: 0.8em;
}

/* Estilo para seções críticas */
.critical-step {
    background-color: #ffeaa7;
    border-left: 4px solid #f39c12;
    padding: 15px;
    margin: 10px 0;
    border-radius: 0 5px 5px 0;
}

.critical-step::before {
    content: "⚠️ ";
    font-size: 1.2em;
    margin-right: 10px;
}

/* Estilo para notas importantes */
.important-note {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
}

.important-note::before {
    content: "💡 ";
    font-weight: bold;
}

/* Contadores automáticos para tabelas */
.sop-template table tbody tr td:first-child {
    font-weight: bold;
    text-align: center;
    background-color: #f8f9fa;
}

/* Números de seção automáticos */
.sop-template {
    counter-reset: section subsection;
}

.sop-template h2::before {
    counter-increment: section;
    content: counter(section) ". ";
}

.sop-template h3::before {
    counter-increment: subsection;
    content: counter(section) "." counter(subsection) " ";
}