/**
 * Realtor Commission Calculator Pro - Frontend Styles
 */

/* CSS Variables for theming */
:root {
    --rccp-primary: #007cba;
    --rccp-secondary: #f0f0f1;
    --rccp-success: #4caf50;
    --rccp-warning: #ff9800;
    --rccp-error: #f44336;
    --rccp-text: #333;
    --rccp-text-light: #666;
    --rccp-bg: #fff;
    --rccp-bg-light: #f8f9fa;
    --rccp-border: #e0e0e0;
    --rccp-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --rccp-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --rccp-radius: 8px;
    --rccp-radius-lg: 12px;
    --rccp-font: system-ui, -apple-system, sans-serif;
    --rccp-transition: all 0.3s ease;
}

/* Dark mode variables */
.rccp-dark-mode {
    --rccp-primary: #4a9eff;
    --rccp-secondary: #2d3748;
    --rccp-text: #e2e8f0;
    --rccp-text-light: #a0aec0;
    --rccp-bg: #1a202c;
    --rccp-bg-light: #2d3748;
    --rccp-border: #4a5568;
    --rccp-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --rccp-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Base styles */
.rccp-calculator {
    font-family: var(--rccp-font);
    color: var(--rccp-text);
    background: var(--rccp-bg);
    border-radius: var(--rccp-radius-lg);
    box-shadow: var(--rccp-shadow);
    padding: 2rem;
    margin: 2rem 0;
    position: relative;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Dark mode toggle */
.rccp-dark-mode-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.rccp-toggle-btn {
    background: var(--rccp-primary);
    border: 2px solid var(--rccp-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--rccp-transition);
    font-size: 1.2rem;
    color: white;
    box-shadow: var(--rccp-shadow);
}

.rccp-toggle-btn:hover {
    background: var(--rccp-primary);
    border-color: var(--rccp-primary);
    color: white;
    transform: scale(1.1);
    box-shadow: var(--rccp-shadow-hover);
}

.rccp-toggle-btn.active {
    background: var(--rccp-primary);
    border-color: var(--rccp-primary);
    color: white;
}

.rccp-toggle-btn i {
    color: white;
}

.rccp-moon-icon {
    display: none;
}

.rccp-dark-mode .rccp-sun-icon {
    display: none;
}

.rccp-dark-mode .rccp-moon-icon {
    display: inline-block;
}

.rccp-sun-icon,
.rccp-moon-icon {
    font-size: 1.2rem;
}

/* Form styles */
.rccp-calculator-form {
    margin-bottom: 2rem;
}

.rccp-form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.rccp-form-header h2 {
    color: var(--rccp-primary);
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
}

.rccp-form-header p {
    color: var(--rccp-text-light);
    font-size: 1.1rem;
    margin: 0;
}

.rccp-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.rccp-form-group {
    display: flex;
    flex-direction: column;
}

.rccp-form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--rccp-text);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rccp-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.rccp-input-group input,
.rccp-input-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--rccp-border);
    border-radius: var(--rccp-radius);
    background: var(--rccp-bg);
    color: var(--rccp-text);
    font-size: 1rem;
    transition: var(--rccp-transition);
    font-family: inherit;
}

.rccp-input-group input:focus,
.rccp-input-group select:focus {
    outline: none;
    border-color: var(--rccp-primary);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.rccp-currency-symbol,
.rccp-percent-symbol {
    position: absolute;
    right: 1rem;
    color: var(--rccp-text-light);
    font-weight: 600;
    pointer-events: none;
    z-index: 2;
}

.rccp-currency-symbol {
    left: 1rem;
    right: auto;
}

.rccp-input-group input[type="number"] {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
}

/* Button styles */
.rccp-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--rccp-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--rccp-transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
}

.rccp-button i {
    font-size: 0.95rem;
}

.rccp-button-primary {
    background: var(--rccp-primary);
    color: white;
}

.rccp-button-primary:hover {
    background: var(--rccp-primary);
    transform: translateY(-2px);
    box-shadow: var(--rccp-shadow-hover);
}

.rccp-button-secondary {
    background: var(--rccp-bg-light);
    color: var(--rccp-text);
    border: 2px solid var(--rccp-border);
}

.rccp-button-secondary:hover {
    background: var(--rccp-border);
    transform: translateY(-2px);
}

.rccp-button-outline {
    background: transparent;
    color: var(--rccp-primary);
    border: 2px solid var(--rccp-primary);
}

.rccp-button-outline:hover {
    background: var(--rccp-primary);
    color: white;
    transform: translateY(-2px);
}

.rccp-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Results section */
.rccp-results {
    background: var(--rccp-bg-light);
    border-radius: var(--rccp-radius-lg);
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid var(--rccp-border);
}

.rccp-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.rccp-results-header h3 {
    color: var(--rccp-primary);
    margin: 0;
    font-size: 1.5rem;
}

.rccp-results-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.rccp-results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.rccp-summary-card {
    background: var(--rccp-bg);
    border-radius: var(--rccp-radius);
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--rccp-border);
    transition: var(--rccp-transition);
}

.rccp-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--rccp-shadow);
}

.rccp-primary-card {
    background: linear-gradient(135deg, var(--rccp-primary), #0056b3);
    color: white;
    border: none;
}

.rccp-summary-card h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.rccp-summary-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.rccp-results-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Responsive wrapper for details */
.rccp-details-section {
    min-width: 0;
    overflow: hidden;
}

.rccp-details-section h4 {
    color: var(--rccp-primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.rccp-details-grid {
    display: grid;
    gap: 1rem;
}

.rccp-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--rccp-bg);
    border-radius: var(--rccp-radius);
    border: 1px solid var(--rccp-border);
    gap: 1rem;
    min-width: 0;
}

.rccp-detail-label {
    font-weight: 500;
    color: var(--rccp-text);
    flex-shrink: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.rccp-detail-value {
    font-weight: 700;
    color: var(--rccp-primary);
    font-size: 1.1rem;
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Chart container */
.rccp-chart-container {
    position: relative;
    height: 300px;
    background: var(--rccp-bg);
    border-radius: var(--rccp-radius);
    padding: 1rem;
    border: 1px solid var(--rccp-border);
    min-width: 0;
    overflow: hidden;
}

.rccp-chart-container canvas {
    max-width: 100%;
    height: auto !important;
}

/* Text breakdown fallback */
.rccp-text-breakdown {
    padding: 1rem;
}

.rccp-text-breakdown h4 {
    color: var(--rccp-primary);
    margin-bottom: 1rem;
    text-align: center;
}

.rccp-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rccp-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--rccp-bg-light);
    border-radius: var(--rccp-radius);
}

.rccp-breakdown-item .label {
    font-weight: 500;
    color: var(--rccp-text);
}

.rccp-breakdown-item .value {
    font-weight: 700;
    color: var(--rccp-primary);
}

/* State comparison */
.rccp-state-comparison {
    background: var(--rccp-bg);
    border-radius: var(--rccp-radius);
    padding: 1.5rem;
    border: 1px solid var(--rccp-border);
    margin-top: 1rem;
}

.rccp-state-comparison h4 {
    color: var(--rccp-primary);
    margin-bottom: 1rem;
}

.rccp-comparison-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--rccp-border);
}

.rccp-comparison-note {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--rccp-bg-light);
    border-radius: var(--rccp-radius);
    font-style: italic;
    color: var(--rccp-text-light);
}

/* Lead capture */
.rccp-lead-capture {
    background: var(--rccp-bg-light);
    border-radius: var(--rccp-radius-lg);
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid var(--rccp-border);
}

.rccp-lead-header {
    text-align: center;
    margin-bottom: 2rem;
}

.rccp-lead-header h3 {
    color: var(--rccp-primary);
    margin-bottom: 0.5rem;
}

.rccp-lead-header p {
    color: var(--rccp-text-light);
    margin: 0;
}

.rccp-lead-form {
    max-width: 600px;
    margin: 0 auto;
}

/* AdSense areas */
.rccp-adsense-area {
    margin: 2rem 0;
    text-align: center;
    padding: 1rem;
    background: var(--rccp-bg-light);
    border-radius: var(--rccp-radius);
    border: 1px solid var(--rccp-border);
}

.rccp-adsense-area iframe,
.rccp-adsense-area ins {
    max-width: 100%;
    height: auto;
}

/* Loading overlay */
.rccp-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.rccp-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: rccp-spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes rccp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Messages */
.rccp-error-message,
.rccp-success-message {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    max-width: 400px;
    border-radius: var(--rccp-radius);
    box-shadow: var(--rccp-shadow);
    animation: rccp-slide-in 0.3s ease;
}

.rccp-error-message {
    background: var(--rccp-error);
    color: white;
}

.rccp-success-message {
    background: var(--rccp-success);
    color: white;
}

.rccp-error-content,
.rccp-success-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    position: relative;
}

.rccp-error-icon,
.rccp-success-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    opacity: 0.95;
}

.rccp-error-text,
.rccp-success-text {
    flex: 1;
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.5;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    word-wrap: break-word;
}

.rccp-message-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: var(--rccp-transition);
    color: white;
    margin-left: 0.5rem;
}

.rccp-message-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.rccp-message-close i {
    font-size: 0.875rem;
}

@keyframes rccp-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal */
.rccp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.rccp-modal-content {
    background: var(--rccp-bg);
    border-radius: var(--rccp-radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--rccp-shadow-hover);
}

.rccp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--rccp-border);
}

.rccp-modal-header h3 {
    margin: 0;
    color: var(--rccp-primary);
}

.rccp-modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--rccp-text-light);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--rccp-transition);
}

.rccp-modal-close i {
    font-size: 1.25rem;
}

.rccp-modal-close:hover {
    background: var(--rccp-bg-light);
    color: var(--rccp-text);
}

.rccp-modal-body {
    padding: 1.5rem;
}

.rccp-share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.rccp-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--rccp-bg-light);
    border: 1px solid var(--rccp-border);
    border-radius: var(--rccp-radius);
    text-decoration: none;
    color: var(--rccp-text);
    transition: var(--rccp-transition);
    font-weight: 500;
}

.rccp-share-btn i {
    font-size: 1.1rem;
}

.rccp-share-btn:hover {
    background: var(--rccp-primary);
    color: white;
    transform: translateY(-2px);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .rccp-calculator {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: var(--rccp-radius);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .rccp-calculator * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .rccp-form-header h2 {
        font-size: 1.5rem;
    }
    
    .rccp-form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .rccp-results-details {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .rccp-detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .rccp-detail-value {
        text-align: left;
        white-space: normal;
        word-break: break-word;
        width: 100%;
    }
    
    .rccp-chart-container {
        height: 250px;
        padding: 0.5rem;
    }
    
    .rccp-details-section {
        overflow-x: visible;
        width: 100%;
    }
    
    .rccp-details-grid {
        overflow-x: visible;
        width: 100%;
    }
    
    .rccp-results-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rccp-summary-value {
        font-size: 1.5rem;
    }
    
    .rccp-results {
        overflow-x: hidden;
        width: 100%;
    }
    
    .rccp-results-content {
        overflow-x: hidden;
        width: 100%;
    }
    
    .rccp-results-actions {
        justify-content: center;
    }
    
    .rccp-form-actions {
        flex-direction: column;
    }
    
    .rccp-share-buttons {
        grid-template-columns: 1fr 1fr;
    }
    
    .rccp-dark-mode-toggle {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 1rem;
        display: flex;
        justify-content: center;
    }
    
    .rccp-error-message,
    .rccp-success-message {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

/* Sticky mobile calculator - DISABLED to fix scrolling issues */
/* .rccp-sticky-mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    border-radius: 0;
    max-height: 100vh;
    overflow-y: auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.rccp-sticky-mobile .rccp-calculator-form {
    margin-bottom: 1rem;
}

.rccp-sticky-mobile .rccp-results {
    margin-top: 1rem;
} */

/* Print styles */
@media print {
    .rccp-dark-mode-toggle,
    .rccp-form-actions,
    .rccp-results-actions,
    .rccp-lead-capture,
    .rccp-adsense-area {
        display: none !important;
    }
    
    .rccp-calculator {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .rccp-results {
        break-inside: avoid;
    }
}

/* Accessibility */
.rccp-calculator *:focus {
    outline: 2px solid var(--rccp-primary);
    outline-offset: 2px;
}

.rccp-button:focus,
.rccp-toggle-btn:focus {
    outline: 2px solid var(--rccp-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .rccp-calculator {
        border: 2px solid var(--rccp-text);
    }
    
    .rccp-button {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* SEO content styles */
.rccp-seo-content {
    background: var(--rccp-bg-light);
    border-radius: var(--rccp-radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--rccp-border);
}

.rccp-seo-content h2,
.rccp-seo-content h3 {
    color: var(--rccp-primary);
    margin-top: 0;
}

.rccp-seo-content ul {
    padding-left: 1.5rem;
}

.rccp-seo-content li {
    margin-bottom: 0.5rem;
}

/* Animation classes */
.rccp-fade-in {
    animation: rccp-fade-in 0.5s ease;
}

@keyframes rccp-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rccp-slide-up {
    animation: rccp-slide-up 0.3s ease;
}

@keyframes rccp-slide-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
