/* Import Google Font (Optional) */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

:root {
    --app-red: #dc3545; /* Bootstrap's danger color */
    --app-white: #f8f9fa; /* Bootstrap's light gray */
    --app-dark: #212529; /* Bootstrap's dark color */
}

body {
    font-family: 'Roboto', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

main {
    flex: 1; /* Ensures footer stays at the bottom */
}

/* --- Theme Overrides & Customizations --- */

/* Ensure links match theme */
a {
    color: var(--app-red);
}
a:hover {
     color: #ff5c6c; /* Lighter red on hover */
}
[data-bs-theme="dark"] a {
    color: var(--app-red);
}
[data-bs-theme="dark"] a:hover {
    color: #ff5c6c;
}

/* Card Styling */
.converter-card .card-header,
.history-card .card-header {
    background-color: var(--app-red);
    color: var(--app-white);
}

[data-bs-theme="light"] .converter-card .card-header,
[data-bs-theme="light"] .history-card .card-header {
     background-color: var(--app-red);
     color: var(--app-white); /* Keep header text white even in light mode */
}

.card {
    transition: box-shadow 0.3s ease;
}
.card:hover {
     box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2) !important;
}
[data-bs-theme="light"] .card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Button Styles */
.btn-danger {
    background-color: var(--app-red);
    border-color: var(--app-red);
}
.btn-danger:hover {
    background-color: #c82333; /* Darker red */
    border-color: #bd2130;
}

.swap-button {
    transition: transform 0.3s ease;
}
.swap-button:hover {
    transform: rotate(180deg);
}
.btn-icon i {
    vertical-align: middle;
}

/* Input/Select Focus */
.form-control:focus,
.form-select:focus {
    border-color: var(--app-red);
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Result Field */
#to-value {
    font-weight: bold;
    transition: background-color 0.3s ease;
}
[data-bs-theme="dark"] #to-value {
    background-color: #343a40; /* Slightly lighter dark */
}
[data-bs-theme="light"] #to-value {
    background-color: #e9ecef; /* Standard light readonly bg */
}


/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.history-card ul li {
    animation: fadeIn 0.5s ease forwards;
}

/* Ensure selects have consistent width in input groups */
.input-group .form-select {
    min-width: 100px; /* Adjust as needed */
}

/* Responsive Adjustments */
@media (max-width: 767.98px) {
    .swap-button {
        margin-bottom: 1rem; /* Add space below swap button on mobile */
    }
    .input-group .form-select {
        min-width: 90px;
    }
    .card-body {
        padding: 1.5rem !important; /* Slightly less padding on mobile */
    }
}

/* --- Accessibility --- */
/* Add distinct focus style for keyboard users */
:focus-visible {
  outline: 3px solid var(--app-red) !important;
  outline-offset: 2px;
  box-shadow: none !important; /* Override Bootstrap focus */
}

/* Voice Button animation */
#voice-input-btn.listening {
    animation: pulse 1.5s infinite;
    border-color: var(--app-red);
    color: var(--app-red);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* History list item hover effect */
#history-list .list-group-item {
    transition: background-color 0.2s ease-in-out;
}
#history-list .list-group-item:not(.text-muted):hover {
     cursor: pointer;
     background-color: rgba(var(--bs-danger-rgb), 0.1); /* Subtle red background on hover */
}

[data-bs-theme="dark"] #history-list .list-group-item:not(.text-muted):hover {
     background-color: rgba(var(--bs-danger-rgb), 0.2);
}

/* Footer Styling */
footer {
     background-color: var(--bs-tertiary-bg); /* Use Bootstrap background utility */
     border-top: 1px solid var(--bs-border-color);
}