/**
 * Fence Calculator - Modern Minimalist Styles
 */

/* Container */
.ecfc-calculator-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Sections */
.ecfc-section {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ecfc-section-title {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 12px;
}

/* Form Elements */
.ecfc-form-row {
    margin-bottom: 20px;
}

.ecfc-form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.ecfc-input,
.ecfc-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.ecfc-select {
    padding-right: 40px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' 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: 20px;
}

.ecfc-input:focus,
.ecfc-select:focus {
    outline: none;
    border-color: #FF0C3A;
    box-shadow: 0 0 0 3px rgba(255, 12, 58, 0.1);
}

.ecfc-input::placeholder {
    color: #999;
}

/* Style Selector */
.ecfc-style-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
}

.ecfc-style-option {
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: border-color 0.2s, transform 0.1s, box-shadow 0.2s;
    background: #ffffff;
    position: relative;
}

.ecfc-style-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.ecfc-style-option.selected {
    border-color: #FF0C3A;
    box-shadow: 0 0 0 2px rgba(255, 12, 58, 0.2);
}

.ecfc-style-image-container {
    width: 100%;
    height: 150px;
    border-radius: 6px;
    margin-bottom: 10px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

.ecfc-style-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    transition: opacity 0.4s ease-in-out;
    opacity: 1;
    display: block;
}

.ecfc-style-option:hover img {
    opacity: 0;
}

.ecfc-style-placeholder {
    width: 100%;
    height: 150px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #666;
}

.ecfc-style-name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-top: 8px;
}

/* Color Swatches */
.ecfc-color-group {
    margin-bottom: 30px;
}

.ecfc-color-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.ecfc-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.ecfc-color-swatch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ecfc-color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ecfc-color-swatch:hover {
    transform: scale(1.1);
}

.ecfc-color-swatch.selected {
    border-color: #FF0C3A;
    box-shadow: 0 0 0 3px rgba(255, 12, 58, 0.3);
}

.ecfc-color-name {
    font-size: 12px;
    color: #666;
    text-align: center;
    max-width: 70px;
    line-height: 1.2;
}

/* Gate availability warning for color swatches */
.ecfc-color-swatch-item.gate-unavailable {
    position: relative;
}

.ecfc-color-swatch.gate-unavailable {
    border: 3px solid #FFA500;
    box-shadow: 0 2px 4px rgba(255, 165, 0, 0.3);
}

.ecfc-color-swatch.gate-unavailable.selected {
    border-color: #FF0C3A;
    box-shadow: 0 0 0 3px rgba(255, 12, 58, 0.3), 0 0 0 5px rgba(255, 165, 0, 0.2);
}

.ecfc-color-swatch-item.gate-unavailable::after {
    content: "⚠";
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #FFA500;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ecfc-gate-warning-tooltip {
    position: absolute;
    bottom: -45px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.ecfc-gate-warning-tooltip::before {
    content: "";
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #333;
}

.ecfc-color-swatch-item.gate-unavailable:hover .ecfc-gate-warning-tooltip {
    opacity: 1;
}

/* Color Options Section */
.ecfc-color-options {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #f0f0f0;
}

/* Run Items */
.ecfc-run-item,
.ecfc-gate-item {
    background: #f9f9f9;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 16px;
}

.ecfc-run-header,
.ecfc-gate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.ecfc-run-title,
.ecfc-gate-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.ecfc-run-fields {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

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

/* Buttons */
.ecfc-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
}

.ecfc-btn:hover {
    transform: translateY(-1px);
}

.ecfc-btn:active {
    transform: translateY(0);
}

.ecfc-btn-primary {
    background: #FF0C3A;
    color: #ffffff;
}

.ecfc-btn-primary:hover {
    background: #E00A33;
}

.ecfc-btn-secondary {
    background: #003857;
    color: #ffffff;
}

.ecfc-btn-secondary:hover {
    background: #002840;
}

.ecfc-btn-danger {
    background: #dc3545;
    color: #ffffff;
    padding: 8px 16px;
    font-size: 14px;
}

.ecfc-btn-danger:hover {
    background: #c82333;
}

.ecfc-btn-lg {
    padding: 16px 32px;
    font-size: 17px;
}

/* Add Run/Gate Containers */
.ecfc-add-run-container,
.ecfc-add-gate-container {
    margin-top: 16px;
}

/* Calculate Section */
.ecfc-calculate-section {
    text-align: center;
    margin-top: 32px;
}

/* Results Section */
.ecfc-results-wrapper {
    margin-top: 40px;
}

.ecfc-results-inner {
    background: #ffffff;
    border: 2px solid #FF0C3A;
    border-radius: 8px;
    padding: 30px;
}

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

.ecfc-bom-title {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
}

.ecfc-bom-subtitle {
    margin: 0;
    font-size: 16px;
    color: #666;
}

/* BOM Tables */
.ecfc-bom-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.ecfc-bom-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

.ecfc-bom-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
}

.ecfc-bom-table tr:last-child td {
    border-bottom: none;
}

.ecfc-bom-table .ecfc-text-right {
    text-align: right;
}

.ecfc-bom-table .ecfc-text-center {
    text-align: center;
}

/* Summary Boxes */
.ecfc-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.ecfc-summary-box {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
}

.ecfc-summary-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.ecfc-summary-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
}

.ecfc-summary-box.ecfc-highlight {
    background: #ffe6eb;
    border-color: #FF0C3A;
}

.ecfc-summary-box.ecfc-highlight .ecfc-summary-value {
    color: #FF0C3A;
}

.ecfc-summary-box.ecfc-success {
    background: #d4edda;
    border-color: #28a745;
}

.ecfc-summary-box.ecfc-success .ecfc-summary-value {
    color: #28a745;
}

/* Installation Links */
.ecfc-installation-links {
    margin: 24px 0;
    padding: 20px;
    background: #f0f8fb;
    border-radius: 6px;
}

.ecfc-installation-links h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.ecfc-installation-links ul {
    margin: 0;
    padding-left: 20px;
}

.ecfc-installation-links li {
    margin-bottom: 8px;
}

.ecfc-installation-links a {
    color: #003857;
    text-decoration: none;
}

.ecfc-installation-links a:hover {
    text-decoration: underline;
}

/* Save BOM Section */
.ecfc-save-bom-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.ecfc-save-bom-form {
    max-width: 500px;
    margin: 20px auto;
}

/* Action Buttons */
.ecfc-action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* Loading Overlay */
.ecfc-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.ecfc-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FF0C3A;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: ecfc-spin 1s linear infinite;
}

@keyframes ecfc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ecfc-loading-overlay p {
    margin-top: 20px;
    font-size: 16px;
    color: #333;
}

/* Inline Loading Spinner */
.ecfc-loading-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    justify-content: center;
    color: #666;
    font-size: 14px;
}

.ecfc-spinner-small {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #FF0C3A;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: ecfc-spin 1s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .ecfc-calculator-wrapper {
        padding: 12px;
    }

    .ecfc-section {
        padding: 20px;
    }

    .ecfc-style-selector {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .ecfc-style-option img,
    .ecfc-style-placeholder {
        height: 120px;
    }

    .ecfc-color-swatches {
        gap: 12px;
    }

    .ecfc-run-fields,
    .ecfc-gate-fields {
        grid-template-columns: 1fr;
    }

    .ecfc-summary-grid {
        grid-template-columns: 1fr;
    }

    .ecfc-run-header,
    .ecfc-gate-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .ecfc-action-buttons {
        flex-direction: column;
    }

    .ecfc-btn {
        width: 100%;
    }
}

/* Empty state */
.ecfc-empty-row {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

