/* 
 * Fourier Transform Calculator CSS
 * Version: 1.0.0
 * Author: clac360
 */

.ftc-clac360-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    background-color: #F5F5F5;
    color: #222222;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

.ftc-clac360-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Container Layout */
.ftc-clac360-main-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

@media (max-width: 1024px) {
    .ftc-clac360-main-container {
        grid-template-columns: 1fr;
    }
}

/* Panel Styling */
.ftc-clac360-panel {
    background-color: #E0E0E0;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ftc-clac360-panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #4A90E2;
}

.ftc-clac360-panel-title h2 {
    color: #222222;
    font-size: 1.5em;
    font-weight: 600;
    line-height: 1.2;
}

/* Colorblind Toggle */
.ftc-clac360-colorblind-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.ftc-clac360-toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    flex-shrink: 0;
}

.ftc-clac360-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ftc-clac360-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.ftc-clac360-toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.ftc-clac360-toggle-switch input:checked + .ftc-clac360-toggle-slider {
    background-color: #4A90E2;
}

.ftc-clac360-toggle-switch input:checked + .ftc-clac360-toggle-slider:before {
    transform: translateX(30px);
}

/* Input Form Styling */
.ftc-clac360-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.ftc-clac360-form-group {
    margin-bottom: 20px;
}

.ftc-clac360-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #222222;
    font-weight: 600;
    font-size: 0.95em;
    line-height: 1.3;
}

.ftc-clac360-sub-label {
    font-size: 0.85em;
    color: #555;
    margin-bottom: 8px;
    font-style: italic;
    line-height: 1.3;
    display: block;
}

.ftc-clac360-input-field,
.ftc-clac360-select-field,
.ftc-clac360-textarea-field {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #333;
    border-radius: 6px;
    background-color: #f9f9f9;
    color: #222222;
    font-size: 1em;
    transition: border-color 0.3s, box-shadow 0.3s;
    min-height: 52px;
    line-height: 1.4;
}

.ftc-clac360-select-field {
    height: 52px;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23222222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.ftc-clac360-textarea-field {
    height: 140px;
    min-height: 140px;
    resize: vertical;
    font-family: monospace, 'Courier New', Courier;
    line-height: 1.5;
    padding: 14px 16px;
}

.ftc-clac360-input-field:focus,
.ftc-clac360-select-field:focus,
.ftc-clac360-textarea-field:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.ftc-clac360-input-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

.ftc-clac360-input-row .ftc-clac360-form-group {
    flex: 1;
}

.ftc-clac360-unit-selector {
    width: 140px;
    margin-top: 0;
    flex-shrink: 0;
}

/* Button Styling */
.ftc-clac360-button-group {
    display: flex;
    gap: 15px;
    margin-top: 35px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid #ccc;
}

.ftc-clac360-btn {
    padding: 16px 32px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 160px;
    min-height: 54px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ftc-clac360-btn-calculate {
    background-color: #4A90E2;
    color: white;
}

.ftc-clac360-btn-calculate:hover {
    background-color: #357ae8;
    transform: translateY(-2px);
}

.ftc-clac360-btn-reset {
    background-color: #FF9500;
    color: white;
}

.ftc-clac360-btn-reset:hover {
    background-color: #e68900;
    transform: translateY(-2px);
}

.ftc-clac360-btn-export {
    background-color: #34C759;
    color: white;
}

.ftc-clac360-btn-export:hover {
    background-color: #2db350;
    transform: translateY(-2px);
}

/* Results Panel */
.ftc-clac360-results-container {
    overflow-y: visible;
    padding-right: 10px;
}

.ftc-clac360-result-section {
    background-color: white;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 25px;
    border-left: 4px solid #4A90E2;
}

.ftc-clac360-result-title {
    color: #222222;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #E0E0E0;
    font-size: 1.2em;
    font-weight: 600;
}

/* Table Styling */
.ftc-clac360-result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9em;
    table-layout: fixed;
}

.ftc-clac360-result-table th {
    background-color: #4A90E2;
    color: white;
    padding: 14px 10px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ftc-clac360-result-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #E0E0E0;
    word-break: break-word;
    overflow-wrap: break-word;
}

.ftc-clac360-result-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.ftc-clac360-result-table tr:hover {
    background-color: #e3f2fd;
}

/* Visualization Container */
.ftc-clac360-visualization-container {
    background-color: white;
    border-radius: 6px;
    padding: 20px;
    margin-top: 25px;
    border: 1px solid #E0E0E0;
}

.ftc-clac360-svg-container {
    width: 100%;
    height: 400px;
    overflow: visible;
}

/* Dynamic Analysis Sections */
.ftc-clac360-dynamic-comment,
.ftc-clac360-dynamic-analysis,
.ftc-clac360-dynamic-recommendation {
    padding: 20px;
    margin: 15px 0;
    border-radius: 6px;
    font-size: 0.95em;
    line-height: 1.8;
}

.ftc-clac360-dynamic-comment {
    background-color: #e3f2fd;
    border-left: 4px solid #2196F3;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.1);
}

.ftc-clac360-dynamic-analysis {
    background-color: #e8f5e8;
    border-left: 4px solid #4CAF50;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.1);
}

.ftc-clac360-dynamic-recommendation {
    background-color: #fff3e0;
    border-left: 4px solid #FF9800;
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.1);
}

.ftc-clac360-analysis-header {
    font-weight: 600;
    color: #222222;
    margin-bottom: 10px;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ftc-clac360-analysis-point {
    margin: 12px 0;
    padding-left: 10px;
    border-left: 2px solid rgba(0, 0, 0, 0.1);
}

.ftc-clac360-critical-warning {
    background-color: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
    border-left: 3px solid #c62828;
    font-weight: 500;
}

.ftc-clac360-performance-indicator {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    margin-left: 8px;
}

.ftc-clac360-good {
    background-color: #c8e6c9;
    color: #2e7d32;
}

.ftc-clac360-warning {
    background-color: #fff3cd;
    color: #856404;
}

.ftc-clac360-critical {
    background-color: #ffcdd2;
    color: #c62828;
}

/* Step by Step Calculations */
.ftc-clac360-step-calculation {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid #ddd;
    line-height: 1.5;
}

/* Colorblind Mode Adaptations */
.ftc-clac360-colorblind-mode .ftc-clac360-magnitude-bar {
    fill: #264653;
    stroke: #000;
    stroke-width: 1;
}

.ftc-clac360-colorblind-mode .ftc-clac360-phase-line {
    stroke: #e76f51;
    stroke-width: 2;
    stroke-dasharray: 5,5;
}

.ftc-clac360-colorblind-mode .ftc-clac360-btn-calculate {
    background-color: #264653;
    position: relative;
}

.ftc-clac360-colorblind-mode .ftc-clac360-btn-calculate::after {
    content: "⟳";
    position: absolute;
    right: 15px;
    font-weight: bold;
}

.ftc-clac360-colorblind-mode .ftc-clac360-btn-reset {
    background-color: #e76f51;
    position: relative;
}

.ftc-clac360-colorblind-mode .ftc-clac360-btn-reset::after {
    content: "↺";
    position: absolute;
    right: 15px;
    font-weight: bold;
}

.ftc-clac360-colorblind-mode .ftc-clac360-btn-export {
    background-color: #2e7d32;
    position: relative;
}

.ftc-clac360-colorblind-mode .ftc-clac360-btn-export::after {
    content: "↓";
    position: absolute;
    right: 15px;
    font-weight: bold;
}

.ftc-clac360-colorblind-mode .ftc-clac360-btn {
    border: 2px solid #222;
    position: relative;
}

/* Enhanced Input Field Styling for Colorblind Mode */
.ftc-clac360-colorblind-mode .ftc-clac360-input-field,
.ftc-clac360-colorblind-mode .ftc-clac360-select-field,
.ftc-clac360-colorblind-mode .ftc-clac360-textarea-field {
    border: 3px solid #222;
    background-color: #fff;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(0,0,0,0.05) 5px,
        rgba(0,0,0,0.05) 10px
    );
    position: relative;
    padding-left: 45px;
}

.ftc-clac360-colorblind-mode .ftc-clac360-textarea-field {
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(0,0,0,0.03) 5px,
        rgba(0,0,0,0.03) 10px
    );
}

/* Input Field Icons for Colorblind Mode */
.ftc-clac360-colorblind-mode .ftc-clac360-input-field::before,
.ftc-clac360-colorblind-mode .ftc-clac360-select-field::before,
.ftc-clac360-colorblind-mode .ftc-clac360-textarea-field::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
}

.ftc-clac360-colorblind-mode .ftc-clac360-textarea-field::before {
    top: 20px;
    transform: none;
}

/* Focus states for colorblind mode */
.ftc-clac360-colorblind-mode .ftc-clac360-input-field:focus,
.ftc-clac360-colorblind-mode .ftc-clac360-select-field:focus,
.ftc-clac360-colorblind-mode .ftc-clac360-textarea-field:focus {
    outline: none;
    border-color: #264653;
    border-width: 3px;
    border-style: dashed;
    box-shadow: 0 0 0 3px rgba(38, 70, 83, 0.3);
}

/* Panel border enhancement for colorblind mode */
.ftc-clac360-colorblind-mode .ftc-clac360-panel {
    border: 2px solid #222;
}

.ftc-clac360-colorblind-mode .ftc-clac360-panel-title {
    border-bottom: 3px dashed #222;
}

/* Table enhancements for colorblind mode */
.ftc-clac360-colorblind-mode .ftc-clac360-result-table th {
    background-color: #264653;
    position: relative;
}

.ftc-clac360-colorblind-mode .ftc-clac360-result-table th::after {
    content: "▼";
    position: absolute;
    right: 10px;
    font-size: 0.8em;
    opacity: 0.7;
}

.ftc-clac360-colorblind-mode .ftc-clac360-result-table tr:nth-child(even) {
    background-color: #f0f0f0;
}

.ftc-clac360-colorblind-mode .ftc-clac360-result-table tr:hover {
    background-color: #e0e0e0;
    outline: 2px dotted #222;
}

/* Section border enhancements */
.ftc-clac360-colorblind-mode .ftc-clac360-result-section {
    border-left: 4px dashed #222;
    border: 2px solid #222;
}

.ftc-clac360-colorblind-mode .ftc-clac360-dynamic-comment {
    border-left: 4px solid #264653;
    background-color: #e8f4f8;
}

.ftc-clac360-colorblind-mode .ftc-clac360-dynamic-analysis {
    border-left: 4px solid #2e7d32;
    background-color: #f0f8f0;
}

.ftc-clac360-colorblind-mode .ftc-clac360-dynamic-recommendation {
    border-left: 4px solid #e76f51;
    background-color: #fff8f0;
}

/* Trademark */
.ftc-clac360-trademark {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 0.8em;
    color: #666;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
}

.ftc-clac360-colorblind-mode .ftc-clac360-trademark {
    border: 2px solid #222;
    background-color: #fff;
    font-weight: bold;
}

.ftc-clac360-colorblind-mode .ftc-clac360-trademark::before {
    content: "© ";
    font-weight: bold;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .ftc-clac360-container {
        padding: 10px;
    }
    
    .ftc-clac360-panel {
        padding: 15px;
    }
    
    .ftc-clac360-form-grid {
        grid-template-columns: 1fr;
    }
    
    .ftc-clac360-button-group {
        flex-direction: column;
    }
    
    .ftc-clac360-btn {
        width: 100%;
    }
    
    .ftc-clac360-input-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .ftc-clac360-unit-selector {
        width: 100%;
    }
    
    .ftc-clac360-result-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .ftc-clac360-svg-container {
        height: 300px;
    }
    
    .ftc-clac360-colorblind-mode .ftc-clac360-input-field,
    .ftc-clac360-colorblind-mode .ftc-clac360-select-field,
    .ftc-clac360-colorblind-mode .ftc-clac360-textarea-field {
        padding-left: 40px;
    }
    
    .ftc-clac360-colorblind-mode .ftc-clac360-input-field::before,
    .ftc-clac360-colorblind-mode .ftc-clac360-select-field::before,
    .ftc-clac360-colorblind-mode .ftc-clac360-textarea-field::before {
        width: 20px;
        height: 20px;
        left: 10px;
    }
    
    .ftc-clac360-colorblind-mode .ftc-clac360-btn::after {
        right: 10px;
    }
    
    .ftc-clac360-trademark {
        position: static;
        margin-top: 20px;
        text-align: center;
        width: 100%;
    }
}

/* Error Styling */
.ftc-clac360-error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    border-left: 4px solid #c62828;
    display: none;
    line-height: 1.4;
}

.ftc-clac360-colorblind-mode .ftc-clac360-error-message {
    border-left: 4px solid #c62828;
    background-color: #ffebee;
    border: 2px solid #c62828;
}

/* Loading Indicator */
.ftc-clac360-loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #4A90E2;
}

.ftc-clac360-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4A90E2;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: ftcClac360Spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes ftcClac360Spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ftc-clac360-colorblind-mode .ftc-clac360-spinner {
    border-top: 4px solid #264653;
}

/* Warning Messages */
.ftc-clac360-warning-message {
    background-color: #fff3cd;
    color: #856404;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
    border-left: 4px solid #ffc107;
    font-size: 0.9em;
    line-height: 1.4;
}

.ftc-clac360-colorblind-mode .ftc-clac360-warning-message {
    border-left: 4px solid #e76f51;
    background-color: #fff3cd;
    border: 2px solid #e76f51;
}

/* Formula Display */
.ftc-clac360-formula-display {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    font-family: "Cambria Math", "Times New Roman", serif;
    font-size: 1.1em;
    text-align: center;
    border: 1px solid #dee2e6;
    line-height: 1.5;
}

/* Ensure text visibility in input fields */
.ftc-clac360-input-field::placeholder,
.ftc-clac360-textarea-field::placeholder {
    color: #666;
    opacity: 0.8;
}

.ftc-clac360-select-field option {
    padding: 10px;
    font-size: 1em;
    line-height: 1.4;
}

/* Ensure dropdown text is visible */
.ftc-clac360-select-field {
    line-height: 1.4;
    padding-top: 14px;
    padding-bottom: 14px;
}

/* Ensure proper spacing between form elements */
.ftc-clac360-form-group:last-child {
    margin-bottom: 0;
}

/* Prevent input field overlapping */
.ftc-clac360-input-field,
.ftc-clac360-select-field,
.ftc-clac360-textarea-field {
    max-width: 100%;
}

/* Clear visibility for all text */
.ftc-clac360-container * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* High contrast for better readability */
.ftc-clac360-input-field,
.ftc-clac360-select-field,
.ftc-clac360-textarea-field {
    color: #222222 !important;
    background-color: #f9f9f9 !important;
}

.ftc-clac360-colorblind-mode .ftc-clac360-input-field,
.ftc-clac360-colorblind-mode .ftc-clac360-select-field,
.ftc-clac360-colorblind-mode .ftc-clac360-textarea-field {
    color: #000000 !important;
    background-color: #ffffff !important;
}