/**
 * Calculator Builder v2.0.0 - Complete Wizard Styles
 * Merged v1.0.0 base layout with v2.0.0 enhancements
 */

/* ============================================
   BASE WIZARD STYLES (v1.0.0)
   ============================================ */

/* General Wizard Styles */
.calcbuilder-wizard {
	/*
    max-width: 1400px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
	*/
}

/* Wizard Header */
.wizard-header {
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 20px;
}

.wizard-header h1 {
    margin: 0 0 20px 0;
    font-size: 28px;
    color: #333;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.wizard-step {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wizard-step.active {
    background: #2196F3;
    color: white;
}

.wizard-step.completed {
    background: #4CAF50;
    color: white;
}

.step-number {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    font-weight: bold;
}

.wizard-step.active .step-number {
    background: rgba(255,255,255,0.9);
    color: #2196F3;
}

.step-title {
    font-weight: 500;
}

/* Wizard Content */
.wizard-content {
    min-height: 500px;
    margin-bottom: 30px;
}

.wizard-panel {
    display: none;
}

.wizard-panel.active {
    display: block;
}

.wizard-panel h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #333;
}

.step-description {
    color: #666;
    margin-bottom: 30px;
}

/* Form Sections */
.form-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 6px;
}

.form-section h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
}

.form-section h4 {
    margin: 15px 0 10px 0;
    font-size: 16px;
    color: #555;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: inline-block;
    margin-right: 20px;
    cursor: pointer;
}

.form-group input[type="radio"] {
    margin-right: 5px;
}

/* Input Fields */
input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

textarea {
    resize: vertical;
    font-family: 'Courier New', monospace;
}

input[type="number"] {
    width: 100px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #2196F3;
    color: white;
}

.btn-primary:hover {
    background: #1976D2;
}

.btn-secondary {
    background: #757575;
    color: white;
}

.btn-secondary:hover {
    background: #616161;
}

.btn-success {
    background: #4CAF50;
    color: white;
}

.btn-success:hover {
    background: #388E3C;
}

/* Wizard Navigation */
.wizard-navigation {
    display: block;
    justify-content: space-between;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
	text-align: center;
}

/* ============================================
   STEP 2: BUILDER LAYOUT (v1.0.0)
   ============================================ */

/* Builder Container - Three Column Layout */
.builder-container {
    display: grid;
    grid-template-columns: 200px 1fr 300px;
    gap: 20px;
    margin-bottom: 30px;
}

/* Toolbox */
.builder-toolbox {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 6px;
}

.builder-toolbox h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
}

.toolbox-elements {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toolbox-element {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: grab;
    transition: all 0.2s ease;
}

.toolbox-element:hover {
    border-color: #2196F3;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.toolbox-element:active {
    cursor: grabbing;
}

.element-icon {
    font-size: 20px;
}

.element-label {
    font-size: 13px;
    font-weight: 500;
}

/* Design Canvas */
.builder-canvas {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
}

.builder-canvas h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
}

.design-canvas {
    display: grid;
    gap: 10px;
    background: white;
    padding: 20px;
    border: 2px dashed #ddd;
    border-radius: 6px;
    min-height: 400px;
}

.canvas-cell {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    min-height: 60px;
    position: relative;
    transition: all 0.2s ease;
}

.canvas-cell.drag-over {
    background: #E3F2FD;
    border-color: #2196F3;
}

/* Placed Elements */
.placed-element {
    width: 100%;
    height: 100%;
    padding: 10px;
    background: white;
    border: 2px solid #4CAF50;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.placed-element:hover {
    border-color: #2196F3;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.placed-element.selected {
    border-color: #FF9800;
    box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.2);
}

.element-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.3s;
}

.placed-element:hover .element-delete-btn {
    opacity: 1;
}

.placed-element label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 12px;
}

.placed-element input,
.placed-element select {
    width: 100%;
    padding: 5px;
    font-size: 12px;
}

.placed-element .radio-option {
    display: block;
    margin: 3px 0;
    font-size: 11px;
}

/* Properties Panel */
.builder-properties {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 6px;
    max-height: 600px;
    overflow-y: auto;
}

.builder-properties h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
}

.properties-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.no-selection {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* ============================================
   v2.0.0 ENHANCEMENTS
   ============================================ */

/* Version Badge */
.version-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
    vertical-align: middle;
}

/* Step 2 Toolbar */
.step2-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.step2-toolbar h2 {
    margin: 0;
}

#form-settings-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

#form-settings-btn:hover {
    background: #1976D2;
}

/* Property Tabs */
.property-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 15px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #2196F3;
}

.tab-btn.active {
    color: #2196F3;
    border-bottom-color: #2196F3;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Property Groups */
.property-group {
    margin-bottom: 15px;
}

.property-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: #333;
    font-size: 13px;
}

.property-group input[type="text"],
.property-group input[type="number"],
.property-group input[type="color"],
.property-group select,
.property-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.property-group input[type="color"] {
    height: 40px;
    cursor: pointer;
}

.property-group input[type="checkbox"] {
    margin-right: 5px;
}

/* Options List */
.options-list {
    margin-bottom: 10px;
}

.option-row {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.option-row input {
    flex: 1;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.remove-option-btn {
    padding: 6px 12px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.add-option-btn {
    width: 100%;
    padding: 8px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

/* Formula Section */
.formula-section {
    margin-top: 30px;
    padding: 20px;
    background: #fffbf0;
    border-radius: 8px;
    border: 1px solid #ffe082;
}

.formula-editor textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.formula-validation {
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
    font-size: 13px;
}

.validation-success {
    color: #2E7D32;
}

.validation-error {
    color: #C62828;
}

.validation-warning {
    color: #F57C00;
}

.formula-help {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.formula-help h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2196F3;
}

.help-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.help-column strong {
    display: block;
    margin-bottom: 8px;
    color: #333;
}

.help-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-column li {
    padding: 3px 0;
    font-size: 13px;
    color: #666;
    font-family: 'Courier New', monospace;
}

.formula-example {
    margin-top: 15px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 4px;
    border-left: 4px solid #2196F3;
}

.formula-example strong {
    display: block;
    margin-bottom: 10px;
    color: #333;
}

.formula-example code {
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #333;
}

/* Actions Section */
.actions-section {
    margin-top: 30px;
    padding: 20px;
    background: #f0f8ff;
    border-radius: 8px;
    border: 1px solid #90caf9;
}

.actions-section h3 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-new {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

.actions-list {
    margin: 20px 0;
}

.action-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.action-header strong {
    color: #2196F3;
    font-size: 15px;
}

.remove-action-btn {
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.3s;
}

.remove-action-btn:hover {
    background: #d32f2f;
}

.action-body .property-group {
    margin-bottom: 12px;
}

.action-body textarea {
    min-height: 80px;
}

#add-action-btn {
    width: 100%;
    padding: 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background 0.3s;
}

#add-action-btn:hover {
    background: #1976D2;
}

#add-action-btn .icon {
    font-size: 18px;
}

.actions-help {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.actions-help h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2196F3;
}

.actions-help ul {
    margin: 0;
    padding-left: 20px;
}

.actions-help li {
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.actions-help code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #d32f2f;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-dialog {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
}

/* ============================================
   CALCULATOR RUNTIME STYLES
   ============================================ */

.calcbuilder-calculator-wrapper {
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.calculator-grid {
    margin-bottom: 20px;
}

.calculator-cell {
    min-height: 40px;
}

.calculator-element {
    height: 100%;
}

.calculator-element label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.calculator-element input[type="number"],
.calculator-element select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.calculator-element input[type="number"]:focus,
.calculator-element select:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    cursor: pointer;
}

.result-display {
    font-size: 24px;
    font-weight: bold;
    padding: 15px;
    text-align: center;
    background: #E8F5E9;
    border: 2px solid #4CAF50;
    border-radius: 4px;
    color: #2E7D32;
}

.calculator-calculate-btn {
    display: block;
    margin: 20px auto 0;
    padding: 12px 24px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.calculator-calculate-btn:hover {
    background: #1976D2;
}

/* Action Messages */
.calculator-actions-container {
    margin-top: 20px;
}

.action-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    border-left: 4px solid;
    animation: slideIn 0.3s ease-out;
}

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

.action-message-info {
    background: #E3F2FD;
    border-left-color: #2196F3;
    color: #1565C0;
}

.action-message-success {
    background: #E8F5E9;
    border-left-color: #4CAF50;
    color: #2E7D32;
}

.action-message-warning {
    background: #FFF3E0;
    border-left-color: #FF9800;
    color: #E65100;
}

.action-message-error {
    background: #FFEBEE;
    border-left-color: #F44336;
    color: #C62828;
}

.action-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.action-content {
    flex: 1;
}

.action-content p {
    margin: 0 0 10px 0;
}

.action-content p:last-child {
    margin-bottom: 0;
}

.action-content strong {
    font-weight: 600;
}

.action-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.action-content li {
    margin-bottom: 5px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .builder-container {
        grid-template-columns: 1fr;
    }
    
    .help-columns {
        grid-template-columns: 1fr;
    }
    
    .modal-dialog {
        width: 95%;
        max-height: 95vh;
    }
    
    .calculator-grid {
        grid-template-columns: 1fr !important;
    }
}
