/**
 * House Tax Calculator - Frontend Styles
 * Professional and responsive design
 */

/* ===== CSS Variables ===== */
:root {
    --htc-primary: #2563eb;
    --htc-primary-dark: #1d4ed8;
    --htc-primary-light: #3b82f6;
    --htc-secondary: #64748b;
    --htc-success: #10b981;
    --htc-warning: #f59e0b;
    --htc-danger: #ef4444;
    --htc-dark: #1e293b;
    --htc-light: #f1f5f9;
    --htc-white: #ffffff;
    --htc-border: #e2e8f0;
    --htc-border-radius: 8px;
    --htc-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --htc-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --htc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --htc-transition: all 0.3s ease;
}

/* ===== Main Container ===== */
.htc-calculator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    max-width: 900px;
    margin: 2rem auto;
    background: var(--htc-white);
    border-radius: var(--htc-border-radius);
    box-shadow: var(--htc-shadow-lg);
    overflow: hidden;
}

/* ===== Header ===== */
.htc-calculator-header {
    background: linear-gradient(135deg, var(--htc-primary) 0%, var(--htc-primary-dark) 100%);
    color: var(--htc-white);
    padding: 2rem;
    text-align: center;
}

.htc-calculator-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.htc-calculator-header h3 .dashicons {
    font-size: 1.75rem;
    width: auto;
    height: auto;
    line-height: 1;
}

.htc-subtitle {
    margin: 0;
    font-size: 1rem;
    opacity: 0.9;
}

/* ===== Form Styles ===== */
.htc-form {
    padding: 2rem;
}

.htc-form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -1rem;
    margin-bottom: 1.5rem;
}

.htc-col-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 1rem;
    box-sizing: border-box;
}

.htc-col-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
}

.htc-form-group {
    margin-bottom: 1.5rem;
}

.htc-form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--htc-dark);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.htc-form-group label .dashicons {
    color: var(--htc-primary);
    font-size: 1.2rem;
}

.htc-input,
.htc-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--htc-border);
    border-radius: var(--htc-border-radius);
    font-size: 1rem;
    color: var(--htc-dark);
    background-color: var(--htc-white);
    transition: var(--htc-transition);
    box-sizing: border-box;
}

.htc-input:focus,
.htc-select:focus {
    outline: none;
    border-color: var(--htc-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.htc-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.htc-input-group {
    display: flex;
    align-items: stretch;
}

.htc-input-addon {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: var(--htc-light);
    border: 2px solid var(--htc-border);
    border-right: none;
    border-radius: var(--htc-border-radius) 0 0 var(--htc-border-radius);
    font-weight: 600;
    color: var(--htc-secondary);
}

.htc-input-group .htc-input {
    border-radius: 0 var(--htc-border-radius) var(--htc-border-radius) 0;
    flex: 1;
}

.htc-help-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--htc-secondary);
    line-height: 1.4;
}

/* ===== Buttons ===== */
.htc-form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--htc-border);
}

.htc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: var(--htc-border-radius);
    cursor: pointer;
    transition: var(--htc-transition);
}

.htc-btn .dashicons {
    font-size: 1.2rem;
}

.htc-btn-primary {
    background: linear-gradient(135deg, var(--htc-primary) 0%, var(--htc-primary-dark) 100%);
    color: var(--htc-white);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.htc-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -1px rgba(37, 99, 235, 0.4);
}

.htc-btn-secondary {
    background-color: var(--htc-light);
    color: var(--htc-secondary);
    border: 2px solid var(--htc-border);
}

.htc-btn-secondary:hover {
    background-color: var(--htc-border);
    color: var(--htc-dark);
}

.htc-btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* ===== Loading Spinner ===== */
.htc-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.htc-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--htc-border);
    border-top: 4px solid var(--htc-primary);
    border-radius: 50%;
    animation: htc-spin 1s linear infinite;
}

@keyframes htc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.htc-loading p {
    margin-top: 1rem;
    color: var(--htc-secondary);
    font-weight: 500;
}

/* ===== Results Section ===== */
.htc-results {
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 3px solid var(--htc-primary);
}

.htc-results h4 {
    margin: 0 0 1.5rem 0;
    color: var(--htc-dark);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.htc-results h4 .dashicons {
    color: var(--htc-primary);
}

.htc-result-section {
    background: var(--htc-white);
    border-radius: var(--htc-border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--htc-shadow-sm);
}

.htc-result-section h5 {
    margin: 0 0 1rem 0;
    color: var(--htc-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.htc-result-grid {
    display: grid;
    gap: 0.75rem;
}

.htc-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--htc-light);
    border-radius: calc(var(--htc-border-radius) / 2);
}

.htc-result-item.htc-highlight {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.htc-result-item .htc-label {
    font-size: 0.9rem;
    color: var(--htc-secondary);
}

.htc-result-item .htc-value {
    font-weight: 600;
    color: var(--htc-dark);
    font-size: 0.95rem;
}

.htc-result-item.htc-highlight .htc-value {
    color: var(--htc-primary);
    font-size: 1.1rem;
}

/* ===== Total Box ===== */
.htc-result-total {
    margin: 1.5rem 0;
}

.htc-total-box {
    background: linear-gradient(135deg, var(--htc-primary) 0%, var(--htc-primary-dark) 100%);
    color: var(--htc-white);
    padding: 2rem;
    border-radius: var(--htc-border-radius);
    text-align: center;
    box-shadow: var(--htc-shadow-lg);
}

.htc-total-label {
    display: block;
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.htc-total-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.htc-total-note {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ===== Disclaimer ===== */
.htc-disclaimer {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--htc-warning);
    border-radius: 0 var(--htc-border-radius) var(--htc-border-radius) 0;
}

.htc-disclaimer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--htc-dark);
    line-height: 1.6;
}

.htc-disclaimer strong {
    color: var(--htc-warning);
}

/* ===== Info Box ===== */
.htc-info-box {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(37, 99, 235, 0.02) 100%);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--htc-border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.htc-info-box h4 {
    margin: 0 0 1rem 0;
    color: var(--htc-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.htc-info-box ul {
    margin: 0;
    padding-left: 1.5rem;
}

.htc-info-box li {
    margin-bottom: 0.5rem;
    color: var(--htc-secondary);
    line-height: 1.5;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .htc-calculator {
        margin: 1rem;
        border-radius: calc(var(--htc-border-radius) / 2);
    }

    .htc-form {
        padding: 1.5rem;
    }

    .htc-calculator-header {
        padding: 1.5rem;
    }

    .htc-calculator-header h3 {
        font-size: 1.4rem;
    }

    .htc-col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .htc-form-actions {
        flex-direction: column;
    }

    .htc-btn {
        width: 100%;
        justify-content: center;
    }

    .htc-total-value {
        font-size: 1.75rem;
    }

    .htc-result-section {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .htc-calculator-header h3 {
        font-size: 1.2rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .htc-form {
        padding: 1rem;
    }

    .htc-input,
    .htc-select {
        padding: 0.625rem 0.875rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ===== Print Styles ===== */
@media print {
    .htc-calculator {
        box-shadow: none;
        margin: 0;
    }

    .htc-form-actions,
    .htc-loading {
        display: none !important;
    }

    .htc-results {
        display: block !important;
        page-break-inside: avoid;
    }
}

/* ===== Accessibility ===== */
.htc-input:focus,
.htc-select:focus,
.htc-btn:focus {
    outline: 2px solid var(--htc-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .htc-calculator {
        border: 2px solid var(--htc-dark);
    }

    .htc-input,
    .htc-select {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
