/* public/css/styles.css - Estilos optimizados */

/* Variables CSS */
:root {
    --primary: #0369a1;
    --primary-light: #0ea5e9;
    --primary-dark: #075985;
    --secondary: #64748b;
    --light: #f1f5f9;
    --dark: #0f172a;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

/* Estilos base */
body {
    font-family: 'Inter', sans-serif;
    color: #334155;
    background-color: #f8fafc;
    transition: background-color 0.3s, color 0.3s;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Contenedor */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .lg\:px-8 {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Grid layout */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-cols-1 {
    grid-template-columns: 1fr;
}

.gap-8 {
    gap: 2rem;
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .lg\:col-span-2 {
        grid-column: span 2 / span 2;
    }

    .lg\:col-span-1 {
        grid-column: span 1 / span 1;
    }
}

/* Estilos de cabecera */
header {
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

header.sticky {
    position: sticky;
    top: 0;
    z-index: 10;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.space-x-4>*+* {
    margin-left: 1rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

.text-xl {
    font-size: 1.25rem;
}

.font-bold {
    font-weight: 700;
}

.text-gray-800 {
    color: #1f2937;
}

.bg-blue-50 {
    background-color: #eff6ff;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.py-1 {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.rounded-full {
    border-radius: 9999px;
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.font-medium {
    font-weight: 500;
}

.text-blue-800 {
    color: #1e40af;
}

.text-blue-600 {
    color: #2563eb;
}

.text-gray-500 {
    color: #6b7280;
}

.h-5,
.w-5 {
    height: 1.25rem;
    width: 1.25rem;
}

/* Estilos personalizados */
.calculator-card {
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    background-color: white;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.calculator-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.tab {
    transition: all 0.3s ease;
    position: relative;
    padding-bottom: 0.75rem;
    padding-left: 1rem;
    padding-right: 1rem;
    cursor: pointer;
}

.tab-active {
    color: var(--primary);
    font-weight: 600;
}

.tab-active:after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary);
    border-radius: 1px;
}

.border-b {
    border-bottom-width: 1px;
    border-bottom-style: solid;
}

.border-gray-200 {
    border-color: #e5e7eb;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.block {
    display: block;
}

.text-gray-700 {
    color: #374151;
}

.relative {
    position: relative;
    width: 100%;
}

.absolute {
    position: absolute;
}

.inset-y-0 {
    top: 0;
    bottom: 0;
}

.left-0 {
    left: 0;
}

.right-0 {
    right: 0;
}

/* Corrección para el símbolo $ y inputs */
.absolute.inset-y-0.left-0 {
    display: flex;
    align-items: center;
}

.absolute.inset-y-0.right-0 {
    display: flex;
    align-items: center;
}

.pl-3 {
    padding-left: 0.75rem;
}

.pl-7 {
    padding-left: 1.75rem;
}

.pr-3 {
    padding-right: 0.75rem;
}

.pr-12 {
    padding-right: 3rem;
}

.pointer-events-none {
    pointer-events: none;
}

input[type="number"] {
    transition: border 0.3s, box-shadow 0.3s;
    width: 100%;
    padding: 0.75rem;
    padding-left: 1.75rem;
    /* Espacio para el símbolo $ */
    padding-right: 3.5rem;
    /* Espacio para MXN/UMA */
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    box-sizing: border-box;
    /* Incluir padding y border en el ancho */
    font-size: 1rem;
    line-height: 1.5;
    height: 2.75rem;
    /* Altura fija para consistencia */
}

input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3);
    outline: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    transition: all 0.3s;
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-align: center;
    font-size: 1rem;
    line-height: 1.5;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background-color: var(--primary-dark);
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.result-animation {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.rounded-md {
    border-radius: 0.375rem;
}

.rounded-xl {
    border-radius: 0.75rem;
}

.text-3xl {
    font-size: 1.875rem;
}

.text-blue-600 {
    color: #2563eb;
}

.hover\:text-blue-800:hover {
    color: #1e40af;
}

.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gap-2 {
    gap: 0.5rem;
}

.text-center {
    text-align: center;
}

.bg-white {
    background-color: white;
}

.rounded {
    border-radius: 0.25rem;
}

.history-item {
    transition: background-color 0.3s;
    padding: 0.5rem;
    border-radius: 0.25rem;
}

.history-item:hover {
    background-color: rgba(14, 165, 233, 0.1);
}

.space-y-2>*+* {
    margin-top: 0.5rem;
}

.max-h-48 {
    max-height: 12rem;
}

.overflow-y-auto {
    overflow-y: auto;
}

.text-lg {
    font-size: 1.125rem;
}

.font-semibold {
    font-weight: 600;
}

.text-red-600 {
    color: #dc2626;
}

/* Responsive table */
.responsive-table {
    overflow-x: auto;
}

table {
    min-width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.5rem 0.75rem;
    text-align: left;
}

th {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.whitespace-nowrap {
    white-space: nowrap;
}

.divide-y>*+* {
    border-top: 1px solid #e5e7eb;
}

/* Footer */
footer {
    background-color: #f1f5f9;
    padding: 2rem 0;
    margin-top: 4rem;
}

.text-gray-600 {
    color: #4b5563;
}

.mt-8 {
    margin-top: 2rem;
}

.pt-8 {
    padding-top: 2rem;
}

.border-t {
    border-top: 1px solid #e5e7eb;
}

.flex-col {
    flex-direction: column;
}

@media (min-width: 768px) {
    .md\:flex-row {
        flex-direction: row;
    }

    .md\:mb-0 {
        margin-bottom: 0;
    }

    .md\:mt-0 {
        margin-top: 0;
    }
}

/* Toast */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-1rem);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 50;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background-color: var(--success);
}

.toast.error {
    background-color: var(--danger);
}

.toast.info {
    background-color: var(--primary);
}

.fixed {
    position: fixed;
}

.top-4 {
    top: 1rem;
}

.right-4 {
    right: 1rem;
}

.z-50 {
    z-index: 50;
}

.z-10 {
    z-index: 10;
}

/* Loader */
.loader {
    border: 3px solid #f3f3f3;
    border-radius: 50%;
    border-top: 3px solid var(--primary);
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Iconos */
.h-8,
.w-8 {
    height: 2rem;
    width: 2rem;
}

.h-4,
.w-4 {
    height: 1rem;
    width: 1rem;
}

.text-blue-500 {
    color: #3b82f6;
}

.mr-2 {
    margin-right: 0.5rem;
}

.mr-4 {
    margin-right: 1rem;
}

svg {
    display: inline;
    vertical-align: -0.125em;
}

/* Soporte de impresión */
@media print {
    body {
        background-color: white;
        color: black;
    }

    .calculator-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    button,
    .history-item,
    #clear-history,
    #theme-toggle {
        display: none;
    }

    #uma-result,
    #mxn-result {
        display: block !important;
        background-color: white;
        color: black;
        border: 1px solid #ddd;
    }

    .responsive-table {
        overflow-x: visible;
    }

    @page {
        margin: 1cm;
    }
}

/* Fix para Safari */
@supports (-webkit-overflow-scrolling: touch) {
    input[type="number"] {
        font-size: 16px;
    }
}

/* Fix para Firefox */
@-moz-document url-prefix() {
    .tab-active::after {
        bottom: -1px;
    }
}

/* Fix adicionales para la calculadora */
#mxn-input,
#uma-input {
    height: auto;
    /* Anula la altura fija para mejor responsividad */
    padding-left: 2rem;
    /* Asegura espacio para el símbolo $ */
}

/* Asegura que los iconos de los resultados sean visibles */
#copy-uma-result,
#copy-mxn-result {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    width: auto;
}

#copy-uma-result svg,
#copy-mxn-result svg {
    height: 1rem;
    width: 1rem;
}

/* Ajustes para la resolución móvil */
@media (max-width: 640px) {
    input[type="number"] {
        font-size: 1rem;
        height: 3rem;
    }

    .calculator-card {
        padding: 1rem;
    }
}