/* LED Wall Calculator - Frontend Styles */

.lwc-calculator-wrapper {
    font-family: var(--lwc-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif);
    max-width: var(--lwc-max-width, 800px);
    margin: 0 auto;
    padding: var(--lwc-padding, 30px);
    background: var(--lwc-background, #f8fafc);
    border-radius: var(--lwc-radius, 8px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    color: var(--lwc-text, #1e293b);
    overflow: visible;
}

.lwc-calculator-wrapper * {
    box-sizing: border-box;
}

.lwc-header {
    text-align: center;
    margin-bottom: 30px;
}

.lwc-title {
    font-size: var(--lwc-title-size, 28px);
    font-weight: 700;
    color: var(--lwc-text, #1e293b);
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.lwc-subtitle {
    font-size: var(--lwc-subtitle-size, 16px);
    color: var(--lwc-text, #1e293b);
    opacity: 0.7;
    margin: 0;
}

.lwc-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.lwc-form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 600px) {
    .lwc-form-row {
        grid-template-columns: 1fr;
    }
}

.lwc-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lwc-form-group.full-width {
    grid-column: 1 / -1;
}

.lwc-label {
    font-size: var(--lwc-label-size, 14px);
    font-weight: 600;
    color: var(--lwc-text, #1e293b);
}

.lwc-input,
.lwc-select {
    font-size: var(--lwc-input-size, 16px);
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: calc(var(--lwc-radius, 8px) / 2);
    background: #fff;
    color: var(--lwc-text, #1e293b);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.lwc-input:focus,
.lwc-select:focus {
    outline: none;
    border-color: var(--lwc-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.lwc-input::placeholder {
    color: #94a3b8;
}

.lwc-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 44px;
}

.lwc-button-group {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.lwc-button {
    flex: 1;
    font-size: var(--lwc-button-size, 16px);
    font-weight: 600;
    padding: 14px 24px;
    border: none;
    border-radius: calc(var(--lwc-radius, 8px) / 2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lwc-button-primary {
    background: linear-gradient(135deg, var(--lwc-primary, #2563eb), var(--lwc-secondary, #1e40af));
    color: #fff;
}

.lwc-button-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.lwc-button-primary:active {
    transform: translateY(0);
}

.lwc-button-secondary {
    background: #e2e8f0;
    color: var(--lwc-text, #1e293b);
}

.lwc-button-secondary:hover {
    background: #cbd5e1;
}

/* Results Section */
.lwc-results {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e2e8f0;
    display: none;
    overflow: visible;
}

.lwc-results.active {
    display: block;
}

.lwc-results.animate {
    animation: slideIn 0.4s ease;
}

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

.lwc-results-title {
    font-size: var(--lwc-result-title-size, 20px);
    font-weight: 700;
    color: var(--lwc-text, #1e293b);
    margin: 0 0 20px 0;
    text-align: center;
}

.lwc-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.lwc-result-card {
    background: #fff;
    border-radius: var(--lwc-radius, 8px);
    padding: 20px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lwc-result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.lwc-result-card.highlight {
    background: linear-gradient(135deg, var(--lwc-primary, #2563eb), var(--lwc-secondary, #1e40af));
    color: #fff;
    border: none;
}

.lwc-result-card.highlight .lwc-result-label {
    color: rgba(255, 255, 255, 0.85);
}

.lwc-result-value {
    font-size: var(--lwc-result-value-size, 24px);
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.2;
}

.lwc-result-label {
    font-size: var(--lwc-label-size, 14px);
    color: #64748b;
}

.lwc-result-secondary {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

.lwc-result-card.highlight .lwc-result-secondary {
    color: rgba(255, 255, 255, 0.7);
}

/* Visual Representation */
.lwc-visual-wrapper {
    margin-top: 24px;
    padding: 20px;
    background: #fff;
    border-radius: var(--lwc-radius, 8px);
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
    overflow: visible;
}

.lwc-visual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.lwc-visual-title {
    font-size: var(--lwc-label-size, 14px);
    font-weight: 600;
    color: var(--lwc-text, #1e293b);
    margin: 0;
}

.lwc-orientation-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 6px;
}

.lwc-orientation-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.lwc-orientation-btn:hover {
    color: var(--lwc-text, #1e293b);
}

.lwc-orientation-btn.active {
    background: #fff;
    color: var(--lwc-primary, #2563eb);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lwc-orientation-btn svg {
    width: 16px;
    height: 16px;
}

.lwc-visual-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    overflow: auto;
    padding: 10px;
}

.lwc-panel-grid {
    display: grid;
    gap: 2px;
    background: #e2e8f0;
    padding: 2px;
    border-radius: 4px;
    max-width: 100%;
}

.lwc-panel-grid.vertical {
    transform: rotate(90deg);
    transform-origin: center center;
}

.lwc-panel-cell {
    background: linear-gradient(135deg, var(--lwc-primary, #2563eb), var(--lwc-secondary, #1e40af));
    border-radius: 2px;
}

.lwc-truncation-note {
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 10px;
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .lwc-calculator-wrapper {
        padding: 20px;
    }
    
    .lwc-button-group {
        flex-direction: column;
    }
    
    .lwc-results-grid {
        grid-template-columns: 1fr;
    }
    
    .lwc-visual-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .lwc-orientation-toggle {
        justify-content: center;
    }
}

/* Loading state */
.lwc-loading {
    position: relative;
    pointer-events: none;
}

.lwc-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--lwc-radius, 8px);
}

.lwc-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--lwc-primary, #2563eb);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Tooltip */
.lwc-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lwc-tooltip-icon {
    width: 16px;
    height: 16px;
    background: #94a3b8;
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
}

.lwc-tooltip-text {
    visibility: hidden;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 8px;
}

.lwc-tooltip:hover .lwc-tooltip-text {
    visibility: visible;
}

.lwc-tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
}
