/**
 * Anagami Calculators - Styles
 * Brand Color: rgb(42, 116, 237)
 */

/* Calculator Container */
.anagami-calculator {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.anagami-calculator__header {
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.anagami-calculator__header h1,
.anagami-calculator__header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.2;
}

.anagami-calculator__body {
    padding: 30px;
    transition: opacity 0.2s ease;
}

/* Loading State - Hidden for fast API calls */
.anagami-calculator__loading {
    display: none !important;
}

.anagami-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid rgb(42, 116, 237);
    border-radius: 50%;
    animation: anagami-spin 0.8s linear infinite;
}

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

/* Error Messages */
.anagami-error {
    display: none;
    padding: 12px 20px;
    margin: 0 30px 20px;
    background: #fee;
    border-left: 4px solid #e74c3c;
    border-radius: 4px;
    font-size: 14px;
    color: #c0392b;
}

.anagami-error__icon {
    margin-right: 8px;
    font-weight: bold;
}

/* VAT Rows Container */
.anagami-rows-container {
    margin-bottom: 25px;
}

.anagami-vat-row {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #dee2e6;
}

.anagami-vat-row:last-child {
    border-bottom: none;
}

/* Form Layout */
.anagami-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    align-items: flex-start;
}

.anagami-form-row--buttons {
    margin-bottom: 30px;
}

.anagami-form-group {
    flex: 1;
    min-width: 0;
}

.anagami-form-group--large {
    flex: 2;
}

.anagami-form-group--medium {
    flex: 1.5;
}

.anagami-form-group--small {
    flex: 1;
}

.anagami-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: #495057;
}

.anagami-form-group .required {
    color: #e74c3c;
}

/* Inputs */
.anagami-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.anagami-input:focus {
    outline: none;
    border-color: rgb(42, 116, 237);
    box-shadow: 0 0 0 3px rgba(42, 116, 237, 0.1);
}

.anagami-input--large {
    font-size: 18px;
    font-weight: 500;
}

.anagami-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.anagami-select:focus {
    outline: none;
    border-color: rgb(42, 116, 237);
    box-shadow: 0 0 0 3px rgba(42, 116, 237, 0.1);
}

/* Display Only */
.anagami-display-only {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.anagami-display-value {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    transition: all 0.3s ease;
}

.anagami-value-updated {
    animation: anagami-pulse 0.6s ease;
}

@keyframes anagami-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Help Text */
.anagami-help-text {
    margin-top: 8px;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.5;
}

/* Buttons */
.anagami-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.anagami-btn--secondary {
    background: #fff;
    color: rgb(42, 116, 237);
    border: 2px solid rgb(42, 116, 237);
}

.anagami-btn--secondary:hover {
    background: rgb(42, 116, 237);
    color: #fff;
}

/* Radio Group */
.anagami-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.anagami-radio-label {
    font-weight: 500;
    font-size: 14px;
    color: #495057;
    margin-bottom: 4px;
}

.anagami-radio {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 15px;
}

.anagami-radio input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: rgb(42, 116, 237);
}

/* Results Section */
.anagami-results {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #e9ecef;
}

.anagami-results--single {
    border-top: none;
    padding-top: 0;
}

.anagami-result-label {
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 15px;
}

.anagami-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.anagami-result-box {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

.anagami-result-box--large {
    padding: 30px;
}

.anagami-result-box--primary {
    background: #e3f2fd;
    border-color: rgb(42, 116, 237);
}

.anagami-result-box__label {
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.anagami-result-box--primary .anagami-result-box__label {
    color: rgb(21, 58, 118);
}

.anagami-result-box__value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    transition: all 0.3s ease;
}

.anagami-result-box--primary .anagami-result-box__value {
    color: rgb(21, 58, 118);
}

/* Responsive */
@media (max-width: 768px) {
    .anagami-calculator__body {
        padding: 20px;
    }
    
    .anagami-form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .anagami-results-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .anagami-result-box__value {
        font-size: 24px;
    }
}

/* WordPress Admin Compatibility */
.wp-admin .anagami-calculator {
    margin: 20px 0;
}

/* Month Sections */
.anagami-month-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.anagami-month-section:last-of-type {
    border-bottom: none;
}

/* Result Inline */
.anagami-result-inline label {
    font-size: 13px;
    color: #6c757d;
}

.anagami-result-inline .anagami-display-value {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-top: 4px;
}

/* Readonly Input */
.anagami-input--readonly {
    background: #e9ecef;
    cursor: not-allowed;
    color: #6c757d;
}

/* Message Box */
.anagami-message-box {
    margin: 30px 0;
    padding: 25px;
    background: #f8f9fa;
    border-left: 4px solid rgb(42, 116, 237);
    border-radius: 6px;
}

.anagami-message-box__text {
    font-size: 13px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 15px 0;
}

.anagami-message-box__value {
    font-size: 16px;
    line-height: 1.6;
    color: #2c3e50;
}

.anagami-message-box__value strong {
    font-size: 24px;
    font-weight: 700;
    color: rgb(42, 116, 237);
    display: block;
    margin-top: 8px;
}

/* VAT Registration Calculator - Grid Layout */
.anagami-months-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin: 24px 0;
}

@media (max-width: 1024px) {
    .anagami-months-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .anagami-months-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .anagami-months-grid {
        grid-template-columns: 1fr;
    }
}

.anagami-month-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.anagami-month-input .anagami-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.anagami-month-input .anagami-input {
    width: 100%;
}

.anagami-threshold-message {
    margin: 24px 0;
}

/* Success message box */
.anagami-message-box--success {
    background-color: #d0f0c2;
    border-left-color: #10b981;
}

/* Warning message box */
.anagami-message-box--warning {
    background-color: #fff3cd;
    border-left-color: #ffc107;
}

/* Larger result boxes */
.anagami-result-box--large {
    padding: 24px;
}

.anagami-result-box--large .anagami-result-box__value {
    font-size: 32px;
}

.anagami-result-box--success {
    background-color: #d0f0c2;
    border-color: #10b981;
}

/* Error message box */
.anagami-message-box--error {
    background-color: #fee2e2;
    border-left-color: #dc2626;
}

/* ============================================
   SME EU Calculator (ID: 7)
   ============================================ */

.anagami-sme-description {
    font-size: 16px;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: #f0f6ff;
    border-left: 4px solid rgb(42, 116, 237);
    border-radius: 0 8px 8px 0;
}

/* Country select row */
.anagami-sme-select-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.anagami-sme-select-row .anagami-label {
    margin: 0;
}

.anagami-sme-select-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.anagami-sme-select-controls .anagami-select {
    width: auto;
    min-width: 200px;
    max-width: 100%;
}

/* Error margin fix */
.anagami-sme-eu-calculator .anagami-error {
    margin: 16px 0 0;
}

/* Country block */
.anagami-sme-country-block {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.anagami-sme-country-block__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 8px 8px 0 0;
}

.anagami-sme-country-block__title {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.anagami-sme-country-block__title strong {
    font-size: 15px;
    color: #1f2937;
}

.anagami-sme-country-block__threshold {
    font-size: 13px;
    color: #9ca3af;
    font-weight: 400;
}

/* Remove buttons – subtle, not aggressive */
.anagami-sme-remove-country {
    background: none;
    color: #9ca3af;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.anagami-sme-remove-country:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

.anagami-sme-remove-delivery {
    background: none;
    color: #d1d5db;
    border: none;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
    visibility: hidden;
}

.anagami-sme-delivery-row:hover .anagami-sme-remove-delivery {
    visibility: visible;
}

.anagami-sme-remove-delivery:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

/* Deliveries list */
.anagami-sme-deliveries-list {
    padding: 14px 20px 6px;
}

.anagami-sme-delivery-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.anagami-sme-delivery-row__label {
    flex: 0 0 95px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
}

.anagami-sme-delivery-row__input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 360px;
}

.anagami-sme-delivery-row__input-wrap .anagami-input {
    flex: 1;
    text-align: right;
    padding: 8px 12px;
    font-size: 14px;
}

.anagami-sme-delivery-row__currency {
    font-size: 13px;
    font-weight: 500;
    color: #9ca3af;
    flex: 0 0 30px;
}

/* Country block footer */
.anagami-sme-country-block__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px 14px;
}

.anagami-sme-country-block__footer .anagami-btn--secondary {
    font-size: 13px;
    padding: 6px 14px;
    border-width: 1px;
}

.anagami-sme-country-block__sum {
    font-size: 13px;
    color: #6b7280;
}

.anagami-sme-country-block__sum strong {
    color: rgb(42, 116, 237);
    font-size: 15px;
    font-weight: 600;
}

/* Calculate button */
#anagami-sme-calculate {
    margin-top: 8px;
}

/* ---- Results ---- */

.anagami-sme-results-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin: 28px 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.anagami-sme-result-country {
    margin-bottom: 14px !important;
    padding: 18px 20px !important;
    border-radius: 8px;
}

.anagami-sme-result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 15px;
}

.anagami-sme-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.anagami-sme-status-icon--ok {
    background: #d1fae5;
    color: #059669;
}

.anagami-sme-status-icon--error {
    background: #fee2e2;
    color: #dc2626;
}

.anagami-sme-status-icon--warning {
    background: #fef3c7;
    color: #d97706;
}

.anagami-sme-result-details {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 14px;
    padding: 0;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.anagami-sme-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    font-size: 14px;
}

.anagami-sme-result-row + .anagami-sme-result-row {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.anagami-sme-result-row span {
    color: #6b7280;
    font-size: 14px;
}

.anagami-sme-result-row strong {
    color: #1f2937;
    font-size: 15px;
    font-weight: 600;
}

.anagami-sme-result-message {
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    color: #4b5563;
}

/* EU total */
.anagami-sme-eu-total-section {
    margin-top: 8px;
}

.anagami-sme-result-eu-total {
    padding: 20px 24px !important;
}

.anagami-sme-result-eu-total .anagami-sme-result-row strong {
    font-size: 17px;
}

/* Responsive */
@media (max-width: 768px) {
    .anagami-sme-country-block__title {
        flex-direction: column;
        gap: 2px;
    }

    .anagami-sme-delivery-row__input-wrap {
        max-width: none;
    }

    .anagami-sme-country-block__footer {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .anagami-sme-country-block__sum {
        text-align: right;
    }
}

@media (max-width: 480px) {
    .anagami-sme-select-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .anagami-sme-select-controls .anagami-select {
        width: 100%;
    }

    .anagami-sme-country-block__header {
        padding: 12px 14px;
    }

    .anagami-sme-deliveries-list {
        padding: 12px 14px 4px;
    }

    .anagami-sme-delivery-row {
        flex-wrap: wrap;
    }

    .anagami-sme-delivery-row__label {
        flex: 0 0 100%;
    }

    .anagami-sme-remove-delivery {
        visibility: visible;
    }

    .anagami-sme-country-block__footer {
        padding: 10px 14px 14px;
    }
}

/* ============================================
   VAT Comparison Calculator (ID: 8)
   ============================================ */

.anagami-comparison-intro {
    margin-bottom: 8px;
}

.anagami-comparison-intro p {
    font-size: 15px;
    font-weight: 500;
    color: #374151;
    margin: 0;
}

.anagami-input-currency {
    font-size: 14px;
    font-weight: 500;
    color: #9ca3af;
    padding-top: 32px;
}

/* Scenario sections */
.anagami-comp-scenario {
    margin-bottom: 24px;
}

.anagami-comp-scenario__title {
    font-size: 15px;
    font-weight: 500;
    color: #374151;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.anagami-comp-scenario__body {
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

/* Result rows */
.anagami-comp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    font-size: 14px;
}

.anagami-comp-row + .anagami-comp-row {
    border-top: 1px solid #e5e7eb;
}

.anagami-comp-row__label {
    color: #6b7280;
    flex: 1;
    padding-right: 16px;
}

.anagami-comp-row__value {
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    font-size: 15px;
}

.anagami-comp-row--subtotal {
    background: #f0f4f8;
}

.anagami-comp-row--total {
    background: #e8edf3;
}

.anagami-comp-row__value--highlight {
    color: rgb(42, 116, 237);
    font-size: 17px;
}

/* Summary */
.anagami-comp-summary {
    margin-top: 8px;
}

.anagami-comp-summary .anagami-message-box {
    margin: 0;
}

.anagami-comp-summary .anagami-message-box__value strong {
    display: inline;
    font-size: inherit;
    margin: 0;
}

@media (max-width: 768px) {
    .anagami-comp-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .anagami-comp-row__label {
        padding-right: 0;
    }

    .anagami-input-currency {
        padding-top: 0;
    }
}

