/* Tax Calculator Module Styles */

.module-container {
    padding: 20px;
    line-height: 1.6;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.module-header h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    margin: 0;
}

.module-header h1 i {
    color: var(--primary-color);
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    background-color: var(--bg-light);
    border-radius: 8px 8px 0 0;
    overflow-x: auto;
}

.tab-navigation button {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    background-color: var(--bg-light);
    border: none;
    border-right: 1px solid var(--border-color);
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.tab-navigation button:last-child {
    border-right: none;
}

.tab-navigation button:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.tab-navigation button.active {
    background-color: var(--primary-color);
    color: white;
}

/* Tab navigation styles */
.tab-button {
    padding: 0.75rem 1.25rem;
    border: none;
    background-color: #f0f0f0;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-button.active {
    background-color: var(--primary-color);
    color: white;
}

.tab-content {
    display: block;
}

.tab-content.hidden {
    display: none;
}

/* Section visibility */
main section {
    display: none;
    padding: 20px 0;
}

main section.active {
    display: block;
}

/* Form Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(45, 123, 224, 0.2);
}

.form-group2 {
    margin-bottom: 15px;
}

.form-group2 label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group2 input[type="text"],
.form-group2 input[type="number"],
.form-group2 input[type="date"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
}

.form-group2 input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(45, 123, 224, 0.2);
}

.form-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* Input with select combo */
.input-with-select {
    display: flex;
}

.input-with-select input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-with-select select {
    width: 80px;
    border: 1px solid var(--border-color);
    border-left: none;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    background-color: var(--bg-light);
    font-size: 16px;
    padding: 0 10px;
}

/* Add these styles for percentage inputs */
.input-with-symbol {
    position: relative;
    display: flex;
}

.input-with-symbol input {
    width: 100%;
    padding-right: 30px; /* Space for the symbol */
    background-color: rgba(0, 0, 0, 0.02);
}

.input-symbol {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-weight: 500;
    pointer-events: none; /* So clicking on it doesn't interfere with input */
}

/* Optional: highlight tax rate fields with a subtle background to differentiate them */
.input-with-symbol input {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Ensure proper visibility of the percentage symbol when input is focused */
.input-with-symbol input:focus + .input-symbol {
    color: var(--primary-color);
}

/* Add these styles for improved visual feedback */

.input-with-symbol.focused {
    box-shadow: 0 0 0 2px rgba(45, 123, 224, 0.2);
    border-radius: 4px;
}

.input-with-symbol.focused input {
    border-color: var(--primary-color);
}

.help-icon {
    margin-left: 5px;
    color: var(--text-secondary);
    font-size: 0.8em;
    cursor: help;
}

/* Create a pulsing effect for the % symbol when the value changes */
@keyframes pulse-symbol {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.input-symbol.changed {
    animation: pulse-symbol 0.5s ease;
}

/* Description */
.description {
    text-align: center;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    color: var(--text-secondary);
}

/* Results section */
#results {
    margin-top: 30px;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#results h3 {
    margin-top: 0;
    text-align: center;
    color: var(--primary-color);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color-light);
}

.results-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.results-section {
    flex: 1;
    min-width: 300px;
}

.results-section table {
    width: 100%;
    border-collapse: collapse;
}

.results-section table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color-light);
}

.results-section table td:first-child {
    font-weight: 500;
}

.total-row {
    font-weight: bold;
    background-color: var(--bg-light);
}

/* Calculation details */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.detail-section {
    margin-bottom: 15px;
}

.detail-section h4 {
    border-bottom: 1px solid var(--border-color-light);
    padding-bottom: 5px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* Filter section */
.filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-box {
    position: relative;
    width: 300px;
    max-width: 100%;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
}

.search-box button {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 40px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.date-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.date-filters div {
    display: flex;
    align-items: center;
}

.date-filters label {
    margin-right: 8px;
    margin-bottom: 0;
    color: var(--text-secondary);
}

.date-filters input {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Input loading state */
.input-loading {
    position: relative;
}

.input-loading::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid rgba(0,0,0,0.2);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading {
    background-color: rgba(0,0,0,0.05);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    padding: 20px;
    position: relative;
    overflow: auto;
}

.modal-content.small {
    max-width: 400px;
}

.modal-content.large {
    max-width: 700px;
    max-height: 80vh;
    
}

.close-modal {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-modal:hover {
    color: var(--danger-color);
}

/* Toast notifications */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 15px;
    background-color: white;
    border-left: 4px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    min-width: 300px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.info {
    border-left-color: var(--primary-color);
}

.toast.success {
    border-left-color: var(--success-color, #4CAF50);
}

.toast.warning {
    border-left-color: var(--warning-color, #FF9800);
}

.toast.error {
    border-left-color: var(--danger-color, #F44336);
}

.toast span {
    flex-grow: 1;
    padding-right: 10px;
}

.close-toast {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
}

.close-toast:hover {
    color: #333;
}

/* Action button styles */
.action-buttons {
    display: flex;
    gap: 5px;
}

.action-buttons button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.action-buttons button:hover {
    color: var(--primary-color);
}

.action-buttons .delete-btn:hover {
    color: var(--danger-color);
}

/* Form section styling */
.form-section {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color-light);
}

.form-section .section-title {
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color-light);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section .section-title i {
    color: var(--primary-color);
}

/* Maintain the grid layout within each section */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
}

/* Style for input with symbol */
.input-with-symbol {
    position: relative;
    display: flex;
}

.input-with-symbol input {
    width: 100%;
    padding-right: 30px;
    background-color: rgba(0, 0, 0, 0.02);
}

.input-symbol {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-weight: 500;
    pointer-events: none;
}

.input-with-symbol.focused input {
    border-color: var(--primary-color);
}

.input-with-symbol.focused .input-symbol {
    color: var(--primary-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-box {
        width: 100%;
    }
    
    .date-filters {
        width: 100%;
        justify-content: space-between;
    }
    
    .form-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .form-buttons .btn {
        width: 100%;
        margin: 5px 0;
    }
    
    .results-section {
        flex: 0 0 100%;
    }
    
    #calculations-table {
        font-size: 14px;
    }
}