/* --- MODERN CALCULATOR STYLES --- */

/* Main wrapper for the entire calculator module */
.avnz-calculator-wrapper {
    /* Use a system font stack for modern OS look and feel */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: #f7f8fc; /* Softer background color */
    padding: 2rem;
    border-radius: 16px; /* Larger radius for a softer look */
    max-width: 900px;
    margin: 2rem auto;
    border: 1px solid #e9eaf2;
    box-shadow: 0 10px 40px rgba(41, 51, 71, 0.05);
}

/* Main title of the calculator */
.avnz-calculator-wrapper h2 {
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: 2rem;
    color: #1d2b48; /* Darker, more professional blue */
    font-weight: 700;
}

/* Grid layout for the two selection cards */
.avnz-form-grid {
    display: grid;
    grid-template-columns: 1fr; /* Default to single column on mobile */
    gap: 2rem;
    margin-bottom: 2.5rem;
}

/* Switch to two columns on larger screens */
@media (min-width: 768px) {
    .avnz-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Individual selection cards (Australia / NZ) */
.avnz-form-section {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #e9eaf2;
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.avnz-form-section:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(41, 51, 71, 0.1);
    border-color: #4a90e2;
}

/* Top border accent on the cards */
.avnz-form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #5e81f2, #7c4dff);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.avnz-form-section:hover::before {
    opacity: 1;
}

/* Card titles (Australia / New Zealand) */
.avnz-form-section h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #1d2b48;
    font-weight: 600;
}

.avnz-form-section h3 span {
    font-size: 1.5rem;
}

/* Dropdown select styles */
.avnz-form-group select {
    width: 100% !important;
    padding: 0.9rem 1rem !important;
    border: 1px solid #dbe0e6 !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    background-color: #fdfdff !important;
    color: #334155 !important;
    transition: all 0.2s ease;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-position: right 0.7rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1.5em 1.5em !important;
    cursor: pointer !important;
}

.avnz-form-group select:focus {
    outline: none !important;
    border-color: #4a90e2 !important;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2) !important;
}

/* Submit Button styles */
.avnz-submit-button {
    background: linear-gradient(135deg, #4a90e2 0%, #2a68a5 100%);
    color: white;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.avnz-submit-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.4);
}

.avnz-submit-button:disabled {
    background: #9fb3c8;
    cursor: not-allowed;
    box-shadow: none;
}

/* Loading spinner animation */
.avnz-loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- RESULTS & MESSAGES --- */

/* General wrapper for results area */
#avnz-results-wrapper {
    margin-top: 3rem;
    border-top: 1px solid #e9eaf2;
    padding-top: 2rem;
    display: none; /* Hidden by default */
}

/* Error and Success message styles */
.avnz-error-message, .avnz-success-message {
    padding: 1.2rem 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid;
}

.avnz-error-message {
    background-color: #fff1f2;
    color: #9f1239;
    border-color: #f43f5e;
}

.avnz-success-message {
    background-color: #f0fdf4;
    color: #166534;
    border-color: #22c55e;
}

/* Results table styling */
.avnz-results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    box-shadow: 0 4px 20px rgba(41, 51, 71, 0.05);
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
}

.avnz-results-table th {
    background: #f1f5f9;
    color: #334155;
    padding: 1rem 1.2rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.avnz-results-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #e9eaf2;
    font-size: 0.95rem;
}

.avnz-results-table tr:last-child td {
    border-bottom: none;
}

.avnz-results-table td:nth-child(2), 
.avnz-results-table td:nth-child(3) {
    text-align: right;
    font-weight: 500;
}

/* Header rows within the table body */
.avnz-results-table .category-header {
    background: #f8fafc;
    color: #1d2b48;
    font-weight: 700;
    font-size: 1rem;
    text-align: left;
}

/* Highlighting for cheaper ('winner') and more expensive ('loser') items */
.avnz-results-table .winner {
    background-color: #f0fdf4;
    color: #15803d;
    font-weight: 600;
}

.avnz-results-table .loser {
    background-color: #fff1f2;
    color: #be123c;
    font-weight: 600;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 767px) {
    .avnz-calculator-wrapper {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .avnz-calculator-wrapper h2 {
        font-size: 1.5rem;
    }
    
    .avnz-form-section {
        padding: 1.5rem;
    }
}
