/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #111827;
    background-color: #f9fafb;
}

/* Utility classes */
.min-h-screen { min-height: 100vh; }
.w-full { width: 100%; }
.max-w-5xl { max-width: 80rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }

/* Flexbox utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

/* Grid utilities */
.grid { display: grid; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Grid columns */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Spacing utilities */
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Colors */
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-900 { background-color: #111827; }
.bg-white { background-color: #ffffff; }
.text-gray-600 { color: #4b5563; }
.text-gray-900 { color: #111827; }
.text-white { color: #ffffff; }
.opacity-70 { opacity: 0.7; }
.opacity-50 { opacity: 0.5; }

/* Border and shadow */
.border { border: 1px solid #d1d5db; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.shadow { box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); }

/* Form elements */
input[type="number"], select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background-color: #ffffff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

input[type="number"]:focus, select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

/* Buttons */
button {
    cursor: pointer;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
    background-color: #ffffff;
    color: #111827;
}

button:hover {
    background-color: #f3f4f6;
}

button.active, .mode-btn.active {
    background-color: #111827;
    color: #ffffff;
    border-color: #111827;
}

button.active:hover, .mode-btn.active:hover {
    background-color: #374151;
}

/* List styles */
.list-disc { list-style-type: disc; }
.pl-5 { padding-left: 1.25rem; }

/* Responsive design */
@media (min-width: 640px) {
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sm\:p-6 { padding: 1.5rem; }
    .sm\:text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
}

/* Custom styles for the calculator */
#equation-preview {
    font-size: 0.875rem;
}

#equation-preview .equation-formula {
    font-size: 0.875rem;
}

#equation-preview .equation-calculation {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

#equation-preview .equation-result {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Hide elements initially */
.hidden {
    display: none !important;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Animation for smooth transitions */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Print styles */
@media print {
    body {
        background-color: white;
    }
    
    .bg-gray-50 {
        background-color: white;
    }
    
    .shadow {
        box-shadow: none;
        border: 1px solid #d1d5db;
    }
}
