/* SmartTax WP Frontend Styles */

.smarttax-calculator {
    max-width: 600px;
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.smarttax-title {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.smarttax-form {
    margin-bottom: 20px;
}

.smarttax-field {
    margin-bottom: 15px;
}

.smarttax-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.smarttax-field .required {
    color: #d63638;
}

.smarttax-field input,
.smarttax-field select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.smarttax-field input:focus,
.smarttax-field select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.smarttax-calculate-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
}

.smarttax-calculate-btn:hover {
    background: #005a87;
}

.smarttax-calculate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading State */
.smarttax-loading {
    text-align: center;
    padding: 20px;
}

.smarttax-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: smarttax-spin 1s linear infinite;
    margin-bottom: 10px;
}

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

/* Error State */
.smarttax-error {
    background: #fff2f2;
    border-left: 4px solid #d63638;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.smarttax-error-message {
    color: #d63638;
    font-weight: 500;
}

/* Results */
.smarttax-results {
    background: #f7f7f7;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.smarttax-results h4 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.smarttax-result-summary {
    background: white;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.smarttax-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.smarttax-result-item:last-child {
    border-bottom: none;
}

.smarttax-result-item.smarttax-highlight {
    background: #e8f5e8;
    padding: 12px;
    margin: 10px -10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
}

.smarttax-result-label {
    color: #555;
    font-weight: 500;
}

.smarttax-result-value {
    color: #333;
    font-weight: 600;
}

.smarttax-highlight .smarttax-result-value {
    color: #2d5a2d;
    font-size: 18px;
}

/* Breakdown */
.smarttax-breakdown {
    background: white;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.smarttax-breakdown h5 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.smarttax-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.smarttax-breakdown-item:last-child {
    border-bottom: none;
}

.smarttax-breakdown-description {
    flex: 1;
    color: #555;
}

.smarttax-breakdown-amount {
    color: #333;
    font-weight: 500;
    margin-left: 15px;
}

/* Actions */
.smarttax-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.smarttax-actions button {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.smarttax-actions button:hover {
    background: #e0e0e0;
    border-color: #999;
}

.smarttax-print-btn:hover {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* Responsive Design */
@media (max-width: 600px) {
    .smarttax-calculator {
        margin: 10px 0;
        padding: 15px;
    }
    
    .smarttax-title {
        font-size: 20px;
    }
    
    .smarttax-result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .smarttax-actions {
        flex-direction: column;
    }
    
    .smarttax-actions button {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .smarttax-calculator {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .smarttax-form,
    .smarttax-actions {
        display: none;
    }
    
    .smarttax-results {
        background: white;
    }
    
    .smarttax-result-summary,
    .smarttax-breakdown {
        border: 1px solid #000;
    }
}

/* Accessibility */
.smarttax-calculator *:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.smarttax-calculator .screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* Animation */
.smarttax-results {
    animation: smarttax-fadeIn 0.3s ease-in;
}

@keyframes smarttax-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================
   MODERN MINIMALIST CALCULATOR
   ================================ */

/* Modern Minimalist Calculator */
.smarttax-modern-calculator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333333;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.smarttax-modern-calculator.theme-light,
.smarttax-modern-calculator.theme-dark {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    min-height: 600px;
    border: 1px solid #f0f0f0;
}

.smarttax-modern-container {
    padding: 48px;
}

/* Header Styles */
.smarttax-modern-header {
    text-align: center;
    margin-bottom: 48px;
}

.smarttax-modern-title {
    font-size: 2.25rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    letter-spacing: -0.025em;
}

.smarttax-modern-subtitle {
    font-size: 1.125rem;
    color: #6b7280;
    margin: 0;
    font-weight: 400;
}

/* Form Container */
.smarttax-modern-form-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}

/* Left Column - Form */
.smarttax-form-column {
    background: #fafafa;
    border-radius: 12px;
    padding: 32px;
    border: 1px solid #e5e7eb;
}

/* Input Sections */
.smarttax-input-section {
    margin-bottom: 32px;
}

.smarttax-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
    min-width: 0; /* Allows items to shrink below their content size */
}

.smarttax-input-group {
    min-width: 0; /* Allows flex items to shrink */
}

.smarttax-input-row:last-child {
    margin-bottom: 0;
}

.smarttax-input-group {
    margin-bottom: 0;
}

.smarttax-input-group.full-width {
    grid-column: 1 / -1;
}

/* Labels */
.smarttax-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.smarttax-label .required {
    color: #ef4444;
    margin-left: 4px;
}

.smarttax-label .optional {
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.8rem;
}

/* Input Styles */
.smarttax-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.smarttax-currency-symbol {
    position: absolute;
    left: 16px;
    font-weight: 500;
    color: #6b7280;
    z-index: 2;
}

.smarttax-modern-calculator .smarttax-input, 
.smarttax-modern-calculator .smarttax-select {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2937;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.smarttax-modern-calculator .smarttax-input:focus, 
.smarttax-modern-calculator .smarttax-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.smarttax-modern-calculator .smarttax-input::placeholder {
    color: #9ca3af;
}

.smarttax-modern-calculator .smarttax-select {
    cursor: pointer;
    padding-left: 16px;
}

/* Toggle Groups */
.smarttax-toggle-group {
    margin-bottom: 24px;
}

.smarttax-toggle-wrapper {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.smarttax-toggle-option {
    flex: 1;
}

.smarttax-toggle-option input[type="radio"] {
    display: none;
}

.smarttax-toggle-label {
    display: block;
    padding: 10px 16px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.smarttax-toggle-option input[type="radio"]:checked + .smarttax-toggle-label {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.smarttax-toggle-label:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.smarttax-toggle-option input[type="radio"]:checked + .smarttax-toggle-label:hover {
    background: #2563eb;
}

/* Percentage Control */
.smarttax-percentage-input {
    margin-top: 8px;
}

.smarttax-percentage-control {
    display: flex;
    gap: 8px;
}

.smarttax-percentage-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 600;
}

.smarttax-percentage-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.smarttax-percentage-btn:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.smarttax-percentage-btn.active:hover {
    background: #2563eb;
}

/* Calculate Button */
.smarttax-button-section {
    margin-top: 32px;
}

.smarttax-calculate-button {
    width: 100%;
    padding: 14px 24px;
    background: #3b82f6;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.smarttax-calculate-button:hover {
    background: #2563eb;
}

.smarttax-calculate-button:active {
    background: #1d4ed8;
}

.smarttax-button-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.smarttax-modern-calculator .smarttax-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Right Column - Results */
.smarttax-results-column {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    border: 1px solid #e5e7eb;
    min-height: 500px;
}

/* Results Header */
.smarttax-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.smarttax-results-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.smarttax-results-toggle {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 4px;
}

.smarttax-toggle-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.smarttax-toggle-btn.active {
    background: #3b82f6;
    color: #ffffff;
}

/* Results Section */
.smarttax-results-section {
    margin-bottom: 28px;
}

.smarttax-results-section h4 {
    margin: 0 0 16px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4b5563;
}

/* Result Items */
.smarttax-modern-calculator .smarttax-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.smarttax-modern-calculator .smarttax-result-item:last-child {
    border-bottom: none;
}

.smarttax-modern-calculator .smarttax-result-label {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
}

.smarttax-result-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 12px;
}

.smarttax-result-icon.epf-icon {
    background: #10b981;
}

.smarttax-result-icon.socso-icon {
    background: #3b82f6;
}

.smarttax-result-icon.eis-icon {
    background: #f59e0b;
}

.smarttax-result-icon.pcb-icon {
    background: #ef4444;
}

.smarttax-modern-calculator .smarttax-result-value {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.875rem;
}

.smarttax-modern-calculator .smarttax-result-value.negative {
    color: #ef4444;
}

.smarttax-modern-calculator .smarttax-result-item.total {
    padding-top: 16px;
    margin-top: 12px;
    border-top: 1px solid #e5e7eb;
    font-weight: 600;
}

.smarttax-modern-calculator .smarttax-result-item.highlight {
    background: #f0f9ff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e0f2fe;
    margin: 16px 0;
}

.smarttax-modern-calculator .smarttax-result-item.highlight .smarttax-result-value {
    font-size: 1.125rem;
    color: #1e40af;
    font-weight: 700;
}

.smarttax-result-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 16px 0;
}

/* Summary Section */
.smarttax-results-section.summary {
    background: #f8fafc;
    border-radius: 8px;
    padding: 24px;
    border: 1px solid #e2e8f0;
}

/* Action Buttons */
.smarttax-results-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.smarttax-action-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.smarttax-action-btn.primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.smarttax-action-btn:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.smarttax-action-btn.primary:hover {
    background: #2563eb;
}

/* Loading States */
.smarttax-loading-container, .smarttax-error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.smarttax-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.smarttax-error-icon {
    width: 48px;
    height: 48px;
    background: #fecaca;
    border-radius: 50%;
    margin-bottom: 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smarttax-error-icon::before {
    content: '!';
    color: #dc2626;
    font-size: 24px;
    font-weight: 700;
}

.smarttax-retry-btn {
    padding: 8px 16px;
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.smarttax-retry-btn:hover {
    background: #2563eb;
}

/* Templates Section */
.smarttax-templates-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}

.smarttax-templates-section h4 {
    margin: 0 0 16px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4b5563;
}

.smarttax-templates-grid {
    display: grid;
    gap: 12px;
}

.smarttax-template-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.smarttax-template-card:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.smarttax-template-card h5 {
    margin: 0 0 8px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
}

.smarttax-template-card p {
    margin: 0;
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.smarttax-results-container {
    animation: fadeIn 0.5s ease;
}

/* Responsive Design for Modern Calculator */
@media (max-width: 640px) {
    .smarttax-modern-container {
        padding: 24px;
    }
    
    .smarttax-modern-form-container {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .smarttax-modern-title {
        font-size: 1.875rem;
    }
    
    .smarttax-input-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .smarttax-toggle-wrapper {
        flex-direction: column;
        gap: 8px;
    }
    
    .smarttax-results-actions {
        flex-direction: column;
    }
    
    .smarttax-results-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .smarttax-modern-calculator {
        padding: 16px;
    }
    
    .smarttax-modern-container {
        padding: 20px;
    }
    
    .smarttax-form-column,
    .smarttax-results-column {
        padding: 24px;
    }
    
    .smarttax-modern-title {
        font-size: 1.75rem;
    }
    
    .smarttax-modern-subtitle {
        font-size: 1rem;
    }
}