/* Estilo base para usar la fuente Inter */
body {
    font-family: 'Inter', sans-serif;
    background-image: url('../img/background.png'); /* Ajusta la ruta si es necesario */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
}

/* Estilos para el header oculto */
header {
    transform: translateY(-calc(100% - 20px)); /* Deja una pestaña de 20px visible */
    transition: transform 0.4s ease-in-out;
}
header:hover {
    transform: translateY(0);
}

/* Estilos para el scrollbar del modal */
.modal-body::-webkit-scrollbar {
    width: 8px;
}
.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Estilos para el modo nocturno */
.dark {
    background-color: rgba(31, 41, 55, 0.95) !important; /* gray-800/95 */
    color: #d1d5db; /* gray-300 */
}
.dark h1, .dark h3, .dark .font-bold, .dark .total {
    color: #f9fafb !important; /* gray-50 */
}
.dark .font-semibold, .dark label, .dark span {
    color: #e5e7eb !important; /* gray-200 */
}
.dark a {
    color: #60a5fa !important; /* blue-400 */
}
.dark input, .dark textarea, .dark select {
    background-color: #374151 !important; /* gray-700 */
    color: #f9fafb !important; /* gray-50 */
    border-color: #4b5563 !important; /* gray-600 */
}
.dark input::placeholder, .dark textarea::placeholder {
    color: #6b7280; /* gray-500 */
}
.dark .border-t, .dark .border-b {
    border-color: #4b5563 !important; /* gray-600 */
}
.dark .bg-gray-200 {
    background-color: #374151 !important; /* gray-700 */
}
.dark .text-blue-600 {
    color: #93c5fd !important; /* blue-300 */
}
.dark [data-feather] {
    color: #9ca3af !important; /* gray-400 */
}
.dark .text-green-500 {
    color: #4ade80 !important; /* green-400 */
}

/* ----- ESTILOS DE IMPRESIÓN MEJORADOS ----- */
@media screen {
    #invoice-print-view {
        display: none;
    }
}

@media print {
    body { 
        -webkit-print-color-adjust: exact !important; 
        print-color-adjust: exact !important;
        background: #fff;
        font-family: 'Inter', sans-serif;
        font-size: 9pt;
        color: #374151; /* gray-700 */
    }
    header, footer.bg-gray-800, .no-print {
        display: none !important;
    }
    main {
        padding: 0 !important;
    }
    #invoice-wrapper {
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        background: none !important;
    }
    #invoice-container {
        display: none !important;
    }
    #invoice-print-view {
        display: block !important;
    }

    /* Info de la empresa y cliente */
    .print-info-section {
        display: flex;
        justify-content: space-between;
        margin-top: 1cm;
        margin-bottom: 1cm;
    }
    .print-info-block {
        width: 48%;
    }
    .print-info-block h3 {
        font-size: 11pt;
        font-weight: 600;
        color: #1e3a8a; /* blue-900 */
        border-bottom: 1px solid #dbeafe; /* blue-100 */
        padding-bottom: 4px;
        margin-bottom: 8px;
    }
    .print-info-block p {
        display: flex;
        align-items: center;
        margin-bottom: 4px;
        font-size: 9pt;
    }
    .print-info-block .icon {
        width: 14px;
        height: 14px;
        margin-right: 8px;
        color: #3b82f6; /* blue-500 */
    }

    /* Tabla de productos */
    .print-items-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 1cm;
    }
    .print-items-table thead {
        display: table-header-group;
    }
    .print-items-table thead th {
        background-color: #1e3a8a !important;
        color: white !important;
        padding: 10px;
        font-size: 9pt;
        text-align: left;
        font-weight: 600;
    }
    .print-items-table tbody tr {
        page-break-inside: avoid;
        border-bottom: 1px solid #e5e7eb; /* gray-200 */
    }
    .print-items-table tbody tr:nth-child(even) {
        background-color: #f8fafc !important; /* slate-50 */
    }
    .print-items-table td {
        padding: 10px;
        vertical-align: top;
    }
    .print-items-table .item-description {
        word-break: break-word;
    }
    .print-items-table .item-image {
        max-height: 45px;
        max-width: 60px;
        margin: auto;
        display: block;
    }

    /* Sección de totales y notas */
    .print-summary-section {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        page-break-inside: avoid;
    }
    .print-notes {
        width: 60%;
    }
    .print-notes h3 {
        font-size: 11pt;
        font-weight: 600;
        color: #1e3a8a;
        margin-bottom: 8px;
    }
    .print-notes p {
        display: flex;
        align-items: center;
        margin-bottom: 4px;
    }
    .print-notes .icon {
        width: 14px;
        height: 14px;
        margin-right: 8px;
        color: #16a34a; /* green-600 */
    }
    .print-totals {
        width: 35%;
        font-size: 10pt;
    }
    .print-totals div {
        display: flex;
        justify-content: space-between;
        padding: 8px;
    }
    .print-totals div:last-child {
        background-color: #dbeafe !important; /* blue-100 */
        border-radius: 8px;
        margin-top: 5px;
    }
    .print-totals .total-label {
        font-weight: 600;
        color: #374151; /* gray-700 */
    }
    .print-totals .total-amount {
        font-weight: 600;
    }
    .print-totals .grand-total-label {
        font-weight: 700;
        color: #1e3a8a; /* blue-900 */
        font-size: 11pt;
    }
    .print-totals .grand-total-amount {
        font-weight: 700;
        color: #1e3a8a; /* blue-900 */
        font-size: 11pt;
    }
}

/* Ocultar las flechas de los inputs de tipo number */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] { -moz-appearance: textfield; }
textarea::placeholder { color: #d1d5db; }
.drag-over { border-color: #3b82f6; background-color: #eff6ff; }
