﻿/* ================================================
   Estilos: Notes Component
   Ubicación: CellFinPlus.FrontEnd.Client/wwwroot/css/notes.css
   Descripción: Estilos para el componente genérico de notas
   Compatible con tema claro y oscuro
   ================================================ */

/* ========================================
   Variables CSS
   ======================================== */
:root {
    --notes-border-radius: 0.75rem;
    --notes-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --notes-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --notes-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-bs-theme="dark"] {
    --notes-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --notes-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ========================================
   Contenedor Principal
   ======================================== */
.notes-container {
    width: 100%;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Header de Notas
   ======================================== */
.notes-header {
    padding: 1rem 0;
    border-bottom: 2px solid var(--bs-border-color);
    margin-bottom: 1.5rem;
}

.notes-stats h5 {
    color: var(--bs-body-color);
    font-weight: 700;
    display: flex;
    align-items: center;
}

.notes-stats small {
    display: block;
    margin-top: 0.25rem;
}

/* ========================================
   Panel de Búsqueda
   ======================================== */
.search-panel {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--notes-border-radius);
    box-shadow: var(--notes-shadow);
    transition: var(--notes-transition);
}

    .search-panel:hover {
        box-shadow: var(--notes-shadow-hover);
    }

[data-bs-theme="dark"] .search-panel {
    background: rgba(var(--bs-tertiary-bg-rgb), 0.5);
}

.search-panel .form-floating > label {
    display: flex;
    align-items: center;
}

.search-panel .form-control:focus,
.search-panel .form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* ========================================
   Lista de Notas
   ======================================== */
.notes-list {
    margin-top: 1.5rem;
}

.note-card {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--notes-border-radius);
    box-shadow: var(--notes-shadow);
    transition: var(--notes-transition);
    position: relative;
    overflow: hidden;
}

    .note-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 4px;
        height: 100%;
        background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-info) 100%);
        opacity: 0;
        transition: var(--notes-transition);
    }

    .note-card:hover {
        box-shadow: var(--notes-shadow-hover);
        transform: translateY(-2px);
    }

        .note-card:hover::before {
            opacity: 1;
        }

[data-bs-theme="dark"] .note-card {
    background: rgba(var(--bs-tertiary-bg-rgb), 0.3);
}

/* ========================================
   Autor de la Nota
   ======================================== */
.note-author {
    flex: 1;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-info) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(var(--bs-primary-rgb), 0.3);
}

[data-bs-theme="dark"] .avatar-circle {
    box-shadow: 0 2px 8px rgba(var(--bs-primary-rgb), 0.5);
}

.note-author strong {
    color: var(--bs-body-color);
    font-size: 1rem;
}

.note-author small {
    font-size: 0.875rem;
}

/* ========================================
   Contenido de la Nota
   ======================================== */
.note-content {
    padding: 1rem;
    background: var(--bs-tertiary-bg);
    border-radius: 0.5rem;
    margin: 0.75rem 0;
    line-height: 1.6;
    color: var(--bs-body-color);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.95rem;
    border-left: 3px solid var(--bs-border-color);
    transition: var(--notes-transition);
}

.note-card:hover .note-content {
    border-left-color: var(--bs-primary);
}

[data-bs-theme="dark"] .note-content {
    background: rgba(0, 0, 0, 0.2);
}

/* ========================================
   Footer de la Nota
   ======================================== */
.note-footer {
    padding-top: 0.75rem;
    border-top: 1px solid var(--bs-border-color);
}

    .note-footer small {
        font-size: 0.8rem;
    }

    .note-footer i {
        opacity: 0.7;
    }

/* ========================================
   Acciones de la Nota
   ======================================== */
.note-actions {
    opacity: 0.5;
    transition: var(--notes-transition);
}

.note-card:hover .note-actions {
    opacity: 1;
}

.note-actions .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    transition: var(--notes-transition);
}

    .note-actions .btn:hover {
        transform: scale(1.1);
    }

/* ========================================
   Estado Vacío
   ======================================== */
.empty-state {
    padding: 3rem 1rem;
    background: var(--bs-tertiary-bg);
    border-radius: var(--notes-border-radius);
    border: 2px dashed var(--bs-border-color);
}

    .empty-state i {
        color: var(--bs-secondary);
        opacity: 0.5;
    }

    .empty-state h5,
    .empty-state p {
        color: var(--bs-secondary);
    }

/* ========================================
   Paginación
   ======================================== */
.pagination-container {
    padding: 1rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--bs-border-color);
}

.pagination-info {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ========================================
   Modal de Nota
   ======================================== */
.modal-body textarea {
    resize: vertical;
    min-height: 150px;
    font-family: inherit;
    line-height: 1.6;
}

    .modal-body textarea:focus {
        border-color: var(--bs-primary);
        box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
    }

.form-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

/* ========================================
   Loading State
   ======================================== */
.notes-container .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* ========================================
   Animaciones
   ======================================== */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.note-card {
    animation: slideInFromLeft 0.3s ease-out;
}

    .note-card:nth-child(1) {
        animation-delay: 0.05s;
    }

    .note-card:nth-child(2) {
        animation-delay: 0.1s;
    }

    .note-card:nth-child(3) {
        animation-delay: 0.15s;
    }

    .note-card:nth-child(4) {
        animation-delay: 0.2s;
    }

    .note-card:nth-child(5) {
        animation-delay: 0.25s;
    }

/* ========================================
   Responsive Design
   ======================================== */

/* Tablets */
@media (max-width: 768px) {
    .notes-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

        .notes-header .btn {
            width: 100%;
        }

    .note-author {
        margin-bottom: 0.75rem;
    }

    .note-actions {
        opacity: 1;
        margin-top: 0.5rem;
        width: 100%;
        justify-content: flex-end;
    }

    .pagination-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .pagination-info {
        order: 2;
    }
}

/* Móviles */
@media (max-width: 576px) {
    .notes-container {
        padding: 0;
    }

    .notes-header h5 {
        font-size: 1.25rem;
    }

    .search-panel .card-body {
        padding: 1rem;
    }

    .note-card {
        margin-bottom: 1rem;
    }

        .note-card .card-body {
            padding: 1rem;
        }

    .avatar-circle {
        width: 35px;
        height: 35px;
        font-size: 0.75rem;
    }

    .note-content {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .note-footer {
        flex-direction: column !important;
        gap: 0.5rem;
        align-items: flex-start !important;
    }

    .empty-state {
        padding: 2rem 1rem;
    }

        .empty-state i {
            font-size: 3rem !important;
        }
}

/* Móviles pequeños */
@media (max-width: 400px) {
    .note-author strong {
        font-size: 0.9rem;
    }

    .note-author small {
        font-size: 0.75rem;
    }

    .note-footer small {
        font-size: 0.75rem;
    }
}

/* ========================================
   Accesibilidad
   ======================================== */

/* Focus visible para navegación por teclado */
.note-actions .btn:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.search-panel .form-control:focus-visible,
.search-panel .form-select:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Alto contraste */
@media (prefers-contrast: high) {
    .note-card {
        border-width: 2px;
    }

    .note-content {
        border-left-width: 4px;
    }
}

/* Reducir animaciones */
@media (prefers-reduced-motion: reduce) {
    .notes-container,
    .note-card,
    .search-panel,
    .note-actions .btn {
        animation: none;
        transition: none;
    }

        .note-card:hover {
            transform: none;
        }
}

/* ========================================
   Mejoras para Dark Mode
   ======================================== */
[data-bs-theme="dark"] .note-card:hover {
    background: rgba(var(--bs-tertiary-bg-rgb), 0.5);
}

[data-bs-theme="dark"] .empty-state {
    background: rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .avatar-circle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ========================================
   Scrollbar personalizado
   ======================================== */
.notes-list::-webkit-scrollbar {
    width: 8px;
}

.notes-list::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
    border-radius: 4px;
}

.notes-list::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 4px;
}

    .notes-list::-webkit-scrollbar-thumb:hover {
        background: var(--bs-primary);
    }

/* ========================================
   Badges de estado
   ======================================== */
.note-card .badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    font-weight: 600;
}

/* ========================================
   Efectos visuales adicionales
   ======================================== */
.note-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient( 45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70% );
    transform: rotate(45deg);
    transition: all 0.5s;
    pointer-events: none;
}

.note-card:hover::after {
    animation: shine 1.5s ease-in-out;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}
