﻿/* =================== Variables de Color =================== */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --accent-hover: #2980b9;
    --bg-primary: #ecf0f1;
    --bg-secondary: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #dfe6e9;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 280px;
    --sidebar-collapsed: 80px;
    --white: #ffffff;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.15);
    --primary-hover: #1a252f;
    --warning-color: #ffc107;
    --warning-hover: #e0a800;
    --danger-color: #dc3545;
    --danger-hover: #c82333;
}

/* =================== Reset y Base =================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-color);
    min-height: 100vh;
    color: var(--dark-color);
}

/* =================== Container Principal =================== */
.container {
    position: relative;
    width: 100%;
    min-height: 100vh;
}

/* =================== Main Content =================== */
.main {
    position: absolute;
    width: calc(100% - 280px);
    left: 280px;
    min-height: 100vh;
    background: var(--light-color);
    transition: 0.5s;
}

    .main.active {
        width: calc(100% - 80px);
        left: 80px;
    }

/* =================== Topbar =================== */
.topbar {
    width: 100%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 900;
}

.toggle {
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
    border-radius: 10px;
}

    .toggle:hover {
        background: var(--light-color);
        transform: rotate(90deg);
    }

.navigation.active ~ .main .toggle {
    transform: rotate(180deg);
}

/* =================== Content Area =================== */
.content {
    padding: 40px;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content h2 {
    color: var(--dark-color);
    font-weight: 700;
    margin-bottom: 30px;
    font-size: 2.5rem;
    display: flex;
    align-items: center;
    gap: 15px;
}

    .content h2::before {
        content: '📝';
        font-size: 2.2rem;
    }

/* =================== Formulario de Búsqueda =================== */
.input-group {
    max-width: 600px;
    box-shadow: var(--shadow);
    border-radius: 12px;
    overflow: hidden;
    background: var(--white);
    margin-bottom: 25px;
}

    .input-group .form-control {
        border: none;
        padding: 15px 20px;
        font-size: 1rem;
        height: 55px;
        background: var(--white);
        color: var(--dark-color);
    }

        .input-group .form-control:focus {
            box-shadow: none;
            outline: none;
            background: var(--white);
        }

        .input-group .form-control::placeholder {
            color: var(--secondary-color);
        }

.input-group-append .btn {
    height: 55px;
    padding: 0 35px;
    border: none;
    background: var(--primary-color);
    color: var(--white);
    font-weight: 600;
    transition: var(--transition);
    font-size: 1rem;
}

    .input-group-append .btn:hover {
        background: var(--primary-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

/* =================== Botones =================== */
.btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

    .btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }

    .btn:active::before {
        width: 300px;
        height: 300px;
    }

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: var(--shadow);
}

    .btn-primary:hover {
        background: var(--primary-hover);
        transform: translateY(-3px);
        box-shadow: var(--shadow-hover);
        color: var(--white);
    }

.btn-warning {
    background: var(--warning-color);
    color: var(--white);
    margin-right: 8px;
    box-shadow: var(--shadow);
}

    .btn-warning:hover {
        background: var(--warning-hover);
        transform: translateY(-3px);
        box-shadow: var(--shadow-hover);
        color: var(--white);
    }

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
    box-shadow: var(--shadow);
}

    .btn-danger:hover {
        background: var(--danger-hover);
        transform: translateY(-3px);
        box-shadow: var(--shadow-hover);
    }

/* =================== Botón Crear Nueva Nota =================== */
.mb-3 .btn-primary {
    padding: 14px 30px;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

    .mb-3 .btn-primary::after {
        content: '+';
        font-size: 1.3rem;
        font-weight: 700;
    }

/* =================== Tabla =================== */
.table {
    background: var(--white);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-top: 20px;
    border-collapse: separate;
    border-spacing: 0;
}

    .table thead {
        background: var(--dark-color);
    }

        .table thead th {
            color: var(--white);
            font-weight: 600;
            padding: 18px 20px;
            border: none;
            text-transform: uppercase;
            font-size: 0.9rem;
            letter-spacing: 0.8px;
            white-space: nowrap;
        }

    .table tbody tr {
        transition: var(--transition);
        border-bottom: 1px solid var(--border-color);
    }

        .table tbody tr:hover {
            background: #f8f9fa;
            transform: scale(1.005);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
        }

    .table tbody td {
        padding: 18px 20px;
        vertical-align: middle;
        color: var(--dark-color);
        border-bottom: 1px solid var(--border-color);
    }

    .table tbody tr:last-child td {
        border-bottom: none;
    }

    /* =================== Columna de Acciones =================== */
    .table tbody td:last-child {
        white-space: nowrap;
        text-align: center;
    }

    /* =================== Estilo para descripción HTML =================== */
    .table tbody td:nth-child(2) {
        max-width: 450px;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.6;
    }

    /* =================== Estilo para fechas =================== */
    .table tbody td:nth-child(3) {
        color: var(--secondary-color);
        font-weight: 500;
        white-space: nowrap;
    }

    /* =================== Loading Animation =================== */
    .table tbody tr {
        animation: slideIn 0.4s ease-out;
    }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =================== Empty State =================== */
.table tbody tr:only-child td {
    text-align: center;
    padding: 60px;
    color: var(--secondary-color);
    font-style: italic;
    font-size: 1.1rem;
}

    .table tbody tr:only-child td::before {
        content: '📋';
        display: block;
        font-size: 3rem;
        margin-bottom: 15px;
    }

/* =================== Badges y Tags =================== */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* =================== Animación de Carga =================== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* =================== Scroll personalizado para la tabla =================== */
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--light-color);
}

    .table-responsive::-webkit-scrollbar {
        height: 8px;
    }

    .table-responsive::-webkit-scrollbar-track {
        background: var(--light-color);
        border-radius: 10px;
    }

    .table-responsive::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 10px;
    }

        .table-responsive::-webkit-scrollbar-thumb:hover {
            background: var(--primary-hover);
        }

/* =========================================
   ARREGLO PARA BOTONES EN TABLAS (AGENDA)
   ========================================= */

/* Para los botones <a> (Detalles, Editar) */
.table td a.btn-warning {
    color: #212529;
    background-color: #ffc107;
    border-color: #ffc107;
}

    .table td a.btn-warning:hover {
        color: #212529;
        background-color: #e0a800;
        border-color: #d39e00;
    }

/* Para el botón <button> (Eliminar) */
.table td button.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

    .table td button.btn-danger:hover {
        color: #fff;
        background-color: #c82333;
        border-color: #bd2130;
    }

/* =================== RESPONSIVE DESIGN =================== */

/* Tablets y pantallas medianas */
@media (max-width: 991px) {
    .main {
        width: calc(100% - 80px);
        left: 80px;
    }

        .main.active {
            width: calc(100% - 80px);
            left: 80px;
        }

    .content {
        padding: 30px;
    }

        .content h2 {
            font-size: 2rem;
        }
}

/* Tablets y móviles */
@media (max-width: 768px) {
    /* Ajustar main para menú colapsado en móviles */
    .main {
        width: calc(100% - 80px);
        left: 80px;
        position: relative;
    }

        .main.active {
            width: calc(100% - 80px);
            left: 80px;
        }

        /* Cuando el menú está expandido */
        .main:not(.active) {
            width: calc(100% - 250px);
            left: 250px;
        }

    .topbar {
        padding: 0 20px;
        height: 60px;
    }

    .toggle {
        width: 45px;
        height: 45px;
        font-size: 2rem;
    }

    .content {
        padding: 20px;
    }

        .content h2 {
            font-size: 1.75rem;
            flex-wrap: wrap;
        }

            .content h2::before {
                font-size: 1.8rem;
            }

    .input-group {
        max-width: 100%;
        flex-direction: column;
    }

        .input-group .form-control {
            border-radius: 12px 12px 0 0;
            height: 50px;
        }

    .input-group-append {
        width: 100%;
    }

        .input-group-append .btn {
            width: 100%;
            border-radius: 0 0 12px 12px;
            height: 50px;
        }

    .table {
        font-size: 0.9rem;
    }

        .table thead th,
        .table tbody td {
            padding: 12px 10px;
        }

    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
        margin-bottom: 5px;
    }

    .mb-3 .btn-primary {
        padding: 12px 24px;
        font-size: 1rem;
        width: 100%;
        justify-content: center;
    }

    /* Ocultar columna de fecha en móvil */
    .table tbody td:nth-child(3) {
        display: none;
    }

    .table thead th:nth-child(3) {
        display: none;
    }

    /* Ajustar botones de acción en móvil */
    .table tbody td:last-child {
        padding: 8px 5px;
    }

        .table tbody td:last-child .btn {
            padding: 8px 12px;
            font-size: 0.85rem;
            margin: 2px 0;
            display: block;
            width: 100%;
        }
}

/* Móviles pequeños */
@media (max-width: 576px) {
    .main {
        width: calc(100% - 70px);
        left: 70px;
    }

        .main.active {
            width: calc(100% - 70px);
            left: 70px;
        }

        .main:not(.active) {
            width: calc(100% - 220px);
            left: 220px;
        }

    .topbar {
        padding: 0 15px;
        height: 55px;
    }

    .toggle {
        width: 40px;
        height: 40px;
        font-size: 1.8rem;
    }

    .content {
        padding: 15px;
    }

        .content h2 {
            font-size: 1.5rem;
        }

            .content h2::before {
                font-size: 1.5rem;
            }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
    }

        .table tbody td:nth-child(2) {
            max-width: 200px;
        }

    .btn {
        padding: 8px 15px;
        font-size: 0.85rem;
        margin: 2px 0;
    }

    .input-group .form-control {
        height: 45px;
        font-size: 0.9rem;
    }

    .input-group-append .btn {
        height: 45px;
        font-size: 0.9rem;
    }

    .mb-3 .btn-primary {
        padding: 10px 20px;
        font-size: 0.95rem;
    }

    /* Tabla responsive con scroll horizontal */
    .table thead th {
        font-size: 0.8rem;
        padding: 10px 8px;
    }

    .table tbody td {
        font-size: 0.85rem;
        padding: 10px 8px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 380px) {
    .main {
        width: calc(100% - 70px);
        left: 70px;
    }

    .toggle {
        width: 35px;
        height: 35px;
        font-size: 1.6rem;
    }

    .content h2 {
        font-size: 1.3rem;
        gap: 8px;
    }

    .btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}
