/*
 * Break-Even Analysis Plugin CSS
 * Add your styles here
 */

/* Break-Even Analysis Form Styles */

.bea-break-even-form {
    max-width: 800px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    overflow: visible;
}

.bea-form__title {
    color: #23282d;
    font-size: 2em;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

/* Progress Bar Styles */
.bea-progress-container {
    margin: 20px 0 30px 0;
    padding: 0;
}

.bea-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #f0f0f1;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.bea-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa 0%, #005177 50%, #0073aa 100%);
    width: 0%;
    transition: width 0.4s ease-in-out;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,115,170,0.3);
}

.bea-progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin: 0;
    padding: 0;
}

.bea-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    color: #666;
    flex: 1;
    position: relative;
}

.bea-progress-step.active {
    color: #0073aa;
    font-weight: 600;
}

.bea-progress-step.completed {
    color: #00a32a;
}

.bea-progress-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #f0f0f1;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.bea-progress-step.active .bea-progress-step-number {
    background-color: #0073aa;
    border-color: #0073aa;
    color: white;
    transform: scale(1.1);
}

.bea-progress-step.completed .bea-progress-step-number {
    background-color: #00a32a;
    border-color: #00a32a;
    color: white;
}

.bea-progress-step-label {
    text-align: center;
    line-height: 1.2;
    margin-top: 3px;
}

.bea-progress-step-label span {
    display: block;
    line-height: 1.1;
}

/* Stage Header Styles */
.bea-stage-header {
    text-align: center;
    margin-bottom: 20px;
}

.bea-stage-number {
    font-size: 2.2em;
    font-weight: bold;
    color: #0073aa;
    margin: 0 0 10px 0;
    text-shadow: 0 1px 3px rgba(0,115,170,0.2);
}

.bea-stage-title {
    font-size: 1.3em;
    font-weight: 600;
    color: #23282d;
    margin: 0 0 15px 0;
}

/* Section Heading Styles - for subsections within stages */
.bea-section-heading {
    font-size: 1.1em;
    font-weight: 600;
    color: #0073aa;
    margin: 25px 0 15px 0;
    padding: 8px 15px;
    background: #f0f6fc;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
    text-align: left;
}

.bea-section-heading:first-of-type {
    margin-top: 15px;
}

.bea-form__stage {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: visible;
}

.bea-form__intro {
    background: #f0f6fc;
    border-left: 4px solid #0073aa;
    padding: 15px 20px;
    margin-bottom: 25px;
    font-size: 1.1em;
    color: #1d2327;
    border-radius: 4px;
}

.bea-form__fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* Full-width field for longer inputs like addresses */
.bea-form__field--full-width {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .bea-form__fields {
        grid-template-columns: 1fr;
    }
    
    /* Improve form container padding on mobile */
    .bea-form-container {
        padding: 15px 10px;
    }
    
    /* Better spacing for form fields on mobile */
    .bea-form__fields {
        gap: 15px;
        margin-bottom: 20px;
    }
    
    /* Adjust input padding for mobile */
    .bea-form__input,
    .bea-form__select {
        padding: 10px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

.bea-form__field {
    position: relative;
}

.bea-form__label {
    display: block;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 8px;
    font-size: 14px;
    text-align: left;
}

.bea-form__input,
.bea-form__select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    background: #fff;
}

.bea-form__input:focus,
.bea-form__select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Ensure text inputs are properly styled */
input[type="text"].bea-form__input {
    width: 100%;
    display: block;
    box-sizing: border-box;
}

.bea-form__input.error {
    border-color: #d63638;
    box-shadow: 0 0 0 1px #d63638;
}

.bea-form__input.auto-calculated {
    background: #f9f9f9;
    border-color: #00a32a;
    position: relative;
}

.bea-form__input.auto-calculated::after {
    content: "📊";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
}

/* Input with suffix (for percentage fields) */
.bea-input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.bea-input-with-suffix .bea-form__input {
    margin: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.bea-input-suffix {
    background: #f6f7f7;
    border: 1px solid #8c8f94;
    border-left: none;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    padding: 12px 12px;
    font-size: 14px;
    color: #50575e;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
    height: auto;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bea-input-with-suffix .bea-form__input:focus + .bea-input-suffix {
    border-color: #0073aa;
}

.bea-form__error {
    color: #d63638;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.bea-form__error.show {
    display: block;
}

.bea-form__stage-message {
    margin: 20px 0;
    padding: 12px 16px;
    border-radius: 4px;
    font-weight: 500;
    display: none;
}

.bea-form__stage-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.bea-form__stage-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.bea-form__stage-message.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Tooltip Styles */
.bea-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    font-size: 12px;
    font-weight: bold;
    margin-left: 5px;
    color: #0073aa;
    transition: color 0.2s ease;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    background-color: #f0f0f1;
    border: 1px solid #dcdcde;
}

.bea-tooltip:hover {
    color: #005a87;
    background-color: #e7f3ff;
    border-color: #0073aa;
}

.bea-tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3338;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
    max-width: 300px;
    min-width: 200px;
    width: max-content;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 9999;
    pointer-events: none;
    transform: translateX(-50%) translateY(-10px);
}

.bea-tooltip::after {
    content: '';
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #2c3338;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9999;
}

.bea-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.bea-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Mobile tooltip adjustments */
@media (max-width: 768px) {
    .bea-tooltip::before {
        max-width: 250px;
        min-width: 180px;
        left: 0;
        transform: none;
        bottom: 140%;
    }
    
    .bea-tooltip::after {
        left: 20px;
        transform: none;
        bottom: 130%;
    }
    
    .bea-tooltip:hover::before {
        transform: translateY(0);
    }
}

/* Specific Tooltip Classes for Different Types */
/* These inherit all base .bea-tooltip styles but allow targeted JavaScript updates */

.bea-tooltip-static {
    /* Static tooltips - never changed by JavaScript */
    /* Used for: interest rates, general explanations, field descriptions */
    position: relative; /* Ensures inheritance works properly */
}

.bea-tooltip-loan {
    /* Dynamic loan-related tooltips */
    /* Used for: loan repayment calculations that change based on loan type */
    position: relative;
}

.bea-tooltip-property {
    /* Property-related tooltips */
    /* Used for: property calculations, valuations, area calculations */
    position: relative;
}

.bea-tooltip-cost {
    /* Cost-related dynamic tooltips */
    /* Used for: fees that might change based on property value or other factors */
    position: relative;
}

.bea-tooltip-revenue {
    /* Revenue-related tooltips */
    /* Used for: rental income calculations, service charges */
    position: relative;
}

.bea-tooltip-projection {
    /* Projection and analysis tooltips */
    /* Used for: future projections, analysis results */
    position: relative;
}

.bea-form__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #dcdcde;
    padding-top: 20px;
    margin-top: 20px;
}

.bea-form__button {
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
    text-decoration: none;
    display: inline-block;
}

.bea-form__button:hover {
    background: #005a87;
}

.bea-form__button:disabled {
    background: #c3c4c7;
    cursor: not-allowed;
}

.bea-form__button--prev {
    background: #50575e;
}

.bea-form__button--prev:hover {
    background: #3c434a;
}

.bea-form__button--submit {
    background: #00a32a;
}

.bea-form__button--submit:hover {
    background: #008a20;
}

.bea-form__stage-message {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
    color: #0c5460;
    display: none;
}

.bea-form__stage-message.success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
    display: block;
}

.bea-form__stage-message.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
    display: block;
}

/* Report Display */
.bea-report {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 30px;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.bea-report h2 {
    color: #0073aa;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.bea-report h3 {
    color: #1d2327;
    margin-top: 25px;
    margin-bottom: 15px;
}

/* Report table wrapper for horizontal scrolling */
.bea-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

.bea-report table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    min-width: 600px; /* Ensure table has minimum width for readability */
}

.bea-report table th,
.bea-report table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dcdcde;
    min-width: 120px;
}

.bea-report table th {
    background: #f6f7f7;
    font-weight: 600;
    color: #1d2327;
}

.bea-report .positive {
    color: #00a32a;
    font-weight: 600;
}

.bea-report .negative {
    color: #d63638;
    font-weight: 600;
}

.bea-report .neutral {
    color: #646970;
}

/* Score Display */
.bea-score-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
}

/* Mobile responsive table styling */
@media (max-width: 768px) {
    .bea-report {
        padding: 15px 10px;
    }
    
    .bea-report table {
        font-size: 14px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .bea-report table th,
    .bea-report table td {
        padding: 8px 10px;
        min-width: 100px;
    }
    
    .bea-report h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .bea-report h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }
}

/* Extra small screens (Galaxy Fold, very narrow phones) */
@media (max-width: 480px) {
    .bea-form-container {
        padding: 10px 5px;
    }
    
    .bea-progress-bar {
        margin: 10px 0 20px 0;
    }
    
    .bea-progress-step {
        flex-direction: column;
        text-align: center;
        margin: 0 5px;
    }
    
    .bea-progress-step-number {
        margin-bottom: 5px;
        margin-right: 0;
    }
    
    .bea-progress-step-label {
        font-size: 10px;
        line-height: 1.2;
    }
    
    .bea-stage-header {
        padding: 15px 10px;
        margin-bottom: 15px;
    }
    
    .bea-stage-number {
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    .bea-stage-title {
        font-size: 16px;
    }
    
    .bea-report table {
        font-size: 12px;
    }
    
    .bea-report table th,
    .bea-report table td {
        padding: 6px 8px;
        min-width: 80px;
    }
    
    .bea-tooltip {
        display: none; /* Hide tooltips on very small screens to save space */
    }
    
    .bea-form__button {
        padding: 12px 20px;
        font-size: 14px;
        width: 100%;
        margin: 5px 0;
    }
    
    .bea-score-display {
        padding: 15px;
        margin: 15px 0;
    }
}

.bea-score-number {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.bea-score-label {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Export Actions */
.bea-export-actions {
    background: #f6f7f7;
    padding: 25px;
    border-radius: 8px;
    margin: 25px 0;
    text-align: center;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bea-export-actions .bea-form__button {
    margin: 8px 12px;
    display: inline-block;
}

/* Download button specific styling to ensure text visibility */
.bea-download-button {
    background: #0073aa !important;
    color: #ffffff !important;
    text-decoration: none !important;
    border: 2px solid #0073aa !important;
    padding: 14px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    display: inline-block !important;
    min-width: 140px !important;
    text-align: center !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0,115,170,0.2) !important;
}

.bea-download-button:hover {
    background: #005a87 !important;
    border-color: #005a87 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0,115,170,0.3) !important;
}

.bea-download-button:visited {
    color: #ffffff !important;
}

.bea-download-button:focus {
    outline: 2px solid #0073aa !important;
    outline-offset: 2px !important;
    color: #ffffff !important;
}

/* Responsive download buttons */
@media (max-width: 768px) {
    .bea-export-actions .bea-form__button {
        display: block !important;
        margin: 10px auto !important;
        width: 90% !important;
        max-width: 280px !important;
    }
    
    .bea-export-actions {
        padding: 20px 15px !important;
    }
}

/* Test Mode Styles */
.bea-test-indicator {
    position: fixed !important;
    top: 50px !important; /* Moved down to avoid WordPress admin bar */
    right: 10px !important;
    z-index: 9999 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    animation: testPulse 2s infinite;
    border: none !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
}

.bea-test-indicator--good {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
}

.bea-test-indicator--bad {
    background: linear-gradient(135deg, #dc3545, #e83e8c) !important;
}

.bea-test-indicator button {
    background: none !important;
    border: none !important;
    color: white !important;
    margin-left: 10px !important;
    cursor: pointer !important;
    font-weight: bold !important;
    font-size: 14px !important;
    padding: 0 !important;
    line-height: 1 !important;
}

.bea-test-indicator button:hover {
    opacity: 0.8 !important;
}

@keyframes testPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.02); }
}

/* Test mode field indicators */
.bea-form__field.test-filled .bea-form__input {
    border-left: 4px solid #28a745 !important;
    background-color: #f8fff9 !important;
}

.bea-test-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #ddd;
    backdrop-filter: blur(10px);
}

.bea-test-button {
    background: #0073aa !important;
    color: #ffffff !important;
    border: 2px solid #0073aa !important;
    padding: 12px 16px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    text-align: center !important;
    display: inline-block !important;
    min-width: 160px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    margin: 4px !important;
}

.bea-test-button:hover {
    background: #005a87 !important;
    border-color: #005a87 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
}

.bea-test-button--good {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: #ffffff !important;
}

.bea-test-button--good:hover {
    background: #1e7e34 !important;
    border-color: #1e7e34 !important;
    color: #ffffff !important;
}

.bea-test-button--bad {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #ffffff !important;
}

.bea-test-button--bad:hover {
    background: #c82333 !important;
    border-color: #c82333 !important;
    color: #ffffff !important;
}

.bea-test-button--crown {
    background: #6f42c1 !important;
    border-color: #6f42c1 !important;
    color: #ffffff !important;
}

.bea-test-button--crown:hover {
    background: #5a2d91 !important;
    border-color: #5a2d91 !important;
    color: #ffffff !important;
}

@media (max-width: 768px) {
    .bea-test-indicator {
        top: 50px !important; /* Account for mobile admin bar */
        right: 5px !important;
        font-size: 10px !important;
        padding: 6px 8px !important;
    }
    
    .bea-test-controls {
        bottom: 10px;
        right: 10px;
        padding: 12px;
        gap: 6px;
    }
    
    .bea-test-button {
        font-size: 12px !important;
        padding: 10px 12px !important;
        min-width: 140px !important;
        margin: 3px !important;
    }
}

/* Additional responsive handling for WordPress admin bar */
body.admin-bar .bea-test-indicator {
    top: 42px !important; /* WordPress admin bar is ~32px + some padding */
}

@media screen and (max-width: 782px) {
    body.admin-bar .bea-test-indicator {
        top: 56px !important; /* Mobile admin bar is taller */
    }
}

@media screen and (max-width: 600px) {
    body.admin-bar .bea-test-indicator {
        top: 50px !important;
    }
}
