.tool-fullwidth {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Tool shell */
.engineering-tool {
    max-width: 100%;
    margin: 0 auto;
}

.engineering-tool .editor-section,
.editor-section.engineering-tool {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.engineering-tool .card:not(.result-card) {
    border: 1px solid var(--color-border, #e5e7eb);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    border-radius: var(--radius, 12px);
    background: var(--color-surface, #fff);
}

.engineering-tool .card-body {
    padding: 1.25rem 1.35rem;
}

.engineering-tool .card-title {
    color: var(--color-text, #1f2937);
    font-weight: 700;
    font-size: 1.05rem;
}

.engineering-tool .form-control,
.engineering-tool .form-select,
.engineering-tool .select-input {
    border-radius: 8px;
    border: 1px solid var(--color-border, #e5e7eb);
}

.engineering-tool .form-control:focus,
.engineering-tool .form-select:focus {
    border-color: var(--color-primary, #0d9488);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.engineering-tool .btn-primary {
    background: var(--color-primary, #0d9488);
    border-color: var(--color-primary, #0d9488);
}

.engineering-tool .btn-primary:hover {
    background: var(--color-primary-hover, #0f766e);
    border-color: var(--color-primary-hover, #0f766e);
}

.engineering-tool .alert {
    border-radius: 10px;
}

[data-theme="dark"] .engineering-tool .card:not(.result-card) {
    background: var(--color-surface, #1f2937);
    border-color: var(--color-border, #374151);
}

[data-theme="dark"] .engineering-tool .card-title,
[data-theme="dark"] .engineering-tool .form-label,
[data-theme="dark"] .engineering-tool {
    color: var(--color-text, #f9fafb);
}

[data-theme="dark"] .engineering-tool .text-muted,
[data-theme="dark"] .engineering-tool .form-text {
    color: var(--color-text-secondary, #9ca3af) !important;
}

[data-theme="dark"] .engineering-tool .form-control,
[data-theme="dark"] .engineering-tool .form-select {
    background: #111827;
    color: var(--color-text, #f9fafb);
    border-color: var(--color-border, #374151);
}

/* --- tool: fence-material-calculator --- */
.fence-calculator-container {
    background: linear-gradient(135deg, #e3f2fd 0%, #f5f5f5 100%);
    min-height: auto;
    padding: 2rem 0;
}

.fence-input-group {
    position: relative;
    margin-bottom: 2rem;
}

.fence-input-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.8rem;
    text-align: center;
}

.fence-input-wrapper {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.fence-input-wrapper:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.fence-input-field {
    width: 100%;
    padding: 1.2rem 4rem 1.2rem 1.5rem;
    border: none;
    font-size: 1.2rem;
    font-weight: 500;
    color: #333;
    background: transparent;
    outline: none;
}

.fence-input-unit {
    position: absolute;
    right: 4rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

.fence-input-buttons {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    width: 3rem;
}

.fence-btn {
    flex: 1;
    border: none;
    background: #f8f9fa;
    color: #495057;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fence-btn:hover {
    background: #e9ecef;
    color: #007bff;
}

.fence-btn:active {
    background: #dee2e6;
    transform: scale(0.95);
}

.fence-btn:first-child {
    border-bottom: 1px solid #dee2e6;
}

.calculate-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.calculate-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.result-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: none;
    overflow: hidden;
}

.result-header {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.result-content {
    padding: 2rem;
}

.result-item {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.result-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: #007bff;
    margin-bottom: 0.3rem;
}

.result-unit {
    font-size: 0.9rem;
    color: #999;
}

.cost-breakdown {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.cost-item:last-child {
    border-bottom: none;
}

.cost-label {
    font-weight: 500;
    color: #333;
}

.cost-value {
    font-weight: 600;
    color: #28a745;
}

.cost-item.total {
    font-size: 1.1rem;
    font-weight: 700;
    color: #007bff;
    border-top: 2px solid #007bff;
    margin-top: 0.5rem;
    padding-top: 1rem;
}

@media (max-width: 768px) {
    .fence-calculator-container {
        padding: 1rem 0;
    }
    
    .fence-input-field {
        font-size: 1rem;
        padding: 1rem 3.5rem 1rem 1rem;
    }
    
    .fence-input-unit {
        right: 3.5rem;
    }
    
    .fence-input-buttons {
        width: 2.5rem;
    }
    
    .result-value {
        font-size: 1.5rem;
    }
}
