/**
 * CSV Anonymizer - Enhanced Styles
 * Bootstrap 5 compatible with dark mode support
 * @author Fabrizio Salmi
 * @version 1.2.0
 */

/* CSS Variables for Light Theme */
:root {
    --body-bg: #f8f9fa;
    --text-color: #343a40;
    --jumbotron-bg: #ffffff;
    --btn-primary-bg: #0d6efd;
    --btn-primary-text: #fff;
    --btn-success-bg: #198754;
    --btn-success-text: #fff;
    --btn-secondary-bg: #6c757d;
    --btn-secondary-text: #fff;
    --btn-info-bg: #0dcaf0;
    --btn-info-text: #000;
    --card-bg: #ffffff;
    --card-text: #343a40;
    --border-color: #dee2e6;
    --input-bg: #fff;
    --input-text-color: #212529;
    --input-border-color: #ced4da;
    --input-focus-border-color: #86b7fe;
    --input-focus-shadow: rgba(13, 110, 253, 0.25);
    --form-text-muted: #6c757d;
    --alert-success-bg: #d1e7dd;
    --alert-success-border: #badbcc;
    --alert-success-text: #0f5132;
    --alert-danger-bg: #f8d7da;
    --alert-danger-border: #f5c2c7;
    --alert-danger-text: #842029;
    --table-striped-bg: rgba(0, 0, 0, 0.05);
    --spinner-color: #0d6efd;
}

body {
    background-color: var(--body-bg);
    color: var(--text-color);
    font-family: 'Nunito', sans-serif; /* Example: Modern, readable font */
    line-height: 1.6;
    transition: background-color 0.5s ease, color 0.5s ease;
    padding-bottom: 20px; /* Add some padding at the bottom */
}

.jumbotron {
    background-color: var(--jumbotron-bg);
    border-radius: 1rem; /* More rounded jumbotron corners */
    padding: 2.5rem; /* Slightly increased padding */
    color: var(--text-color);
    position: relative;
    transition: background-color 0.5s ease, color 0.5s ease;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.05); /* Slightly stronger shadow for more depth */
    border: 1px solid var(--border-color); /* Add a subtle border */
}

.display-4 {
    font-weight: 700; /* Make the title bolder */
    margin-bottom: 1.25rem; /* More space under the title */
}

.lead {
    font-size: 1.1rem; /* Slightly larger lead text */
    font-weight: 500; /* Slightly bolder lead text */
    margin-bottom: 2rem; /* More space under lead text */
}

hr.my-4 {
    border-top: 1px solid var(--border-color);
    opacity: 0.5; /* Slightly less opaque hr */
}

.form-control-file {
    margin-bottom: 1rem;
}

.btn-primary, .btn-secondary, .btn-success {
    border-radius: 0.5rem; /* More rounded button corners */
    padding: 0.75rem 1.5rem; /* Adjust button padding */
    font-weight: 600; /* Bolder button text */
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease; /* Add transform for button press effect */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.08); /* Add a small base shadow to buttons */
}

.btn-primary {
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.4), 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15); /* Enhanced hover shadow */
    transform: translateY(-2px); /* Slight lift on hover */
}

.btn-primary:active {
    transform: translateY(1px); /* Push down effect on click */
    box-shadow: 0 0.05rem 0.1rem rgba(0, 0, 0, 0.15); /* Reduced shadow when active */
}

.btn-primary:focus, .btn-primary.focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5), 0 0.125rem 0.25rem rgba(0, 0, 0, 0.08); /* Keep shadow on focus, less intense outer ring */
}


.btn-success {
    background-color: var(--btn-success-bg);
    border-color: var(--btn-success-bg);
    color: var(--btn-success-text);
}

.btn-success:hover {
    background-color: #1e7e34;
    border-color: #1e7e34;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.4), 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.btn-success:active {
    transform: translateY(1px);
    box-shadow: 0 0.05rem 0.1rem rgba(0, 0, 0, 0.15);
}


.btn-success:focus, .btn-success.focus {
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5), 0 0.125rem 0.25rem rgba(0, 0, 0, 0.08);
}

.btn-secondary {
    background-color: var(--btn-secondary-bg);
    border-color: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
}

.btn-secondary:hover {
    background-color: #545b62; /* Darken on hover */
    border-color: #545b62;
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.4), 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(1px);
    box-shadow: 0 0.05rem 0.1rem rgba(0, 0, 0, 0.15);
}

.btn-secondary:focus, .btn-secondary.focus {
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5), 0 0.125rem 0.25rem rgba(0, 0, 0, 0.08);
}


.card-body {
    background-color: var(--card-bg);
    color: var(--card-text);
    border-radius: 0.75rem; /* More rounded card corners */
    padding: 1.5rem; /* Adjusted card padding */
    transition: background-color 0.5s ease, color 0.5s ease;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.05); /* Slightly stronger card shadow */
    border: 1px solid var(--border-color); /* Add subtle card border */
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Bootstrap 5 form updates */
.mb-3 {
    margin-bottom: 1.5rem;
}

.form-label {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border-color);
    color: var(--input-text-color);
    border-radius: 0.5rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--input-bg);
    border-color: var(--input-focus-border-color);
    color: var(--input-text-color);
    box-shadow: 0 0 0 0.25rem var(--input-focus-shadow);
}



.form-check {
    margin-bottom: 1rem;
}

.form-check-input:checked {
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
}

.form-check-input:focus {
    border-color: var(--input-focus-border-color);
    box-shadow: 0 0 0 0.25rem var(--input-focus-shadow);
}

.form-check-label {
    color: var(--text-color);
}


.form-text {
    font-size: 0.875rem;
    color: var(--form-text-muted);
    margin-top: 0.25rem;
}

/* Enhanced alerts */
.alert {
    border-radius: 0.5rem;
    border: 1px solid transparent;
}

.alert-success {
    background-color: var(--alert-success-bg);
    border-color: var(--alert-success-border);
    color: var(--alert-success-text);
}

.alert-danger {
    background-color: var(--alert-danger-bg);
    border-color: var(--alert-danger-border);
    color: var(--alert-danger-text);
}

/* Table improvements */
.table {
    color: var(--text-color);
}

.table-striped > tbody > tr:nth-of-type(odd) > td,
.table-striped > tbody > tr:nth-of-type(odd) > th {
    background-color: var(--table-striped-bg);
}

/* Progress bar */
.progress {
    background-color: var(--input-border-color);
}

.progress-bar {
    background-color: var(--btn-primary-bg);
}

/* Spinner */
.spinner-border {
    color: var(--spinner-color);
}

#numberFuzzFactorOutput,
#stringFuzzProbabilityOutput,
#stringLightFuzzProbabilityOutput {
    display: inline-block;
    margin-left: 0.5rem;
    font-weight: 500;
    color: var(--text-color); /* Output text color */
}


#processingMessage {
    margin-top: 1.5rem;
    color: grey;
    font-style: italic; /* Make processing message italic */
}

#downloadLinkContainer {
    margin-top: 2rem;
}

#errorMessage {
    margin-top: 1.5rem;
    border-radius: 0.5rem; /* Rounded error message corners */
    padding: 1rem; /* Padding for error message */
}

/* Range input specific styling for better appearance */
input[type="range"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 0.7rem; /* Adjusted range input height */
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 0.7rem;
    background: #dee2e6; /* Range track background */
    border-radius: 0.5rem;
    border: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    height: 1.4rem; /* Adjusted thumb size */
    width: 1.4rem;
    border-radius: 50%;
    background: var(--btn-primary-bg); /* Range thumb color */
    margin-top: -0.35rem; /* Adjust thumb position to center on track */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.15); /* Thumb shadow */
    transition: background-color 0.2s ease, transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #0056b3; /* Darker thumb on hover */
    transform: scale(1.1); /* Slightly enlarge thumb on hover */
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 0.7rem;
    background: #dee2e6;
    border-radius: 0.5rem;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    border: none;
    height: 1.4rem;
    width: 1.4rem;
    border-radius: 50%;
    background: var(--btn-primary-bg);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #0056b3;
    transform: scale(1.1);
}

input[type="range"]::-ms-track {
    width: 100%;
    height: 0.7rem;
    background: transparent;
    border-color: transparent;
    color: transparent;
}

input[type="range"]::-ms-fill-lower,
input[type="range"]::-ms-fill-upper {
    background: #dee2e6;
    border-radius: 0.5rem;
}

input[type="range"]::-ms-thumb {
    border: none;
    height: 1.4rem;
    width: 1.4rem;
    border-radius: 50%;
    background: var(--btn-primary-bg);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

input[type="range"]::-ms-thumb:hover {
    background: #0056b3;
    transform: scale(1.1);
}

/* Enhanced collapse animation */
.collapse {
    transition: height 0.35s ease;
}

.collapsing {
    transition: height 0.35s ease;
}

/* File upload area improvements */
.form-control[type="file"] {
    padding: 0.5rem;
}

.form-control[type="file"]::-webkit-file-upload-button {
    background-color: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    margin-right: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.form-control[type="file"]::-webkit-file-upload-button:hover {
    background-color: #565e64;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .jumbotron {
        padding: 1.5rem;
    }
    
    .display-4 {
        font-size: 1.75rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}


small img {
    vertical-align: middle;
    display: inline-block;
    margin-left: 0.3em;
}

/* Dark mode support (respects system preference) */
@media (prefers-color-scheme: dark) {
    :root {
        --body-bg: #212529;
        --text-color: #f8f9fa;
        --jumbotron-bg: #343a40;
        --card-bg: #343a40;
        --card-text: #f8f9fa;
        --border-color: #495057;
        --input-bg: #495057;
        --input-text-color: #f8f9fa;
        --input-border-color: #6c757d;
        --input-focus-border-color: #86b7fe;
        --form-text-muted: #adb5bd;
        --alert-success-bg: #0f5132;
        --alert-success-border: #2d7b47;
        --alert-success-text: #75b798;
        --alert-danger-bg: #842029;
        --alert-danger-border: #a0434d;
        --alert-danger-text: #f8d7da;
        --table-striped-bg: rgba(255, 255, 255, 0.05);
    }
}

/* Utility classes */
.text-muted {
    color: var(--form-text-muted) !important;
}

/* Loading states */
.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Focus indicators for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --input-border-color: #000;
        --border-color: #000;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .form-control,
    .form-select {
        border-width: 2px;
    }
}
