/**
 * WooCommerce Material Calculator - Frontend Styles
 */

:root {
    --wmc-accent: #EB0028;
    --wmc-accent-hover: #C90022;
    --wmc-accent-light: rgba(235, 0, 40, 0.1);
    --wmc-gray-50: #F9FAFB;
    --wmc-gray-100: #F3F4F6;
    --wmc-gray-200: #E5E7EB;
    --wmc-gray-300: #D1D5DB;
    --wmc-gray-400: #9CA3AF;
    --wmc-gray-500: #6B7280;
    --wmc-gray-600: #4B5563;
    --wmc-gray-700: #374151;
    --wmc-gray-800: #1F2937;
    --wmc-gray-900: #111827;
    --wmc-white: #FFFFFF;
    --wmc-radius: 12px;
    --wmc-radius-lg: 16px;
    --wmc-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --wmc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --wmc-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Product Page Button */
.wmc-product-button-wrapper {
    margin: 20px 0;
}

.wmc-open-calculator {
    background: var(--wmc-accent) !important;
    color: var(--wmc-white) !important;
    border: none !important;
    padding: 14px 32px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: var(--wmc-radius) !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--wmc-shadow);
    width: 100%;
    max-width: 400px;
}

.wmc-open-calculator:hover {
    background: var(--wmc-accent-hover) !important;
    transform: translateY(-1px);
    box-shadow: var(--wmc-shadow-lg);
}

.wmc-open-calculator:focus {
    outline: 3px solid var(--wmc-accent-light);
    outline-offset: 2px;
}

.wmc-open-calculator:active {
    transform: translateY(0);
}

/* Modal Overlay */
.wmc-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.wmc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: wmcFadeIn 0.2s ease;
}

@keyframes wmcFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.wmc-modal-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    margin: auto;
    animation: wmcSlideUp 0.3s ease;
}

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

.wmc-modal-content {
    background: var(--wmc-white);
    border-radius: var(--wmc-radius-lg);
    box-shadow: var(--wmc-shadow-xl);
    padding: 32px;
    position: relative;
    overflow-y: auto;
    max-height: 90vh;
}

/* Close Button */
.wmc-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border: none;
    background: var(--wmc-gray-800);
    color: var(--wmc-white);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
    flex-shrink: 0;
}

.wmc-modal-close svg {
    width: 20px;
    height: 20px;
    stroke-width: 3;
}

.wmc-modal-close:hover {
    background: var(--wmc-gray-900);
    transform: scale(1.05);
}

.wmc-modal-close:focus {
    outline: 3px solid var(--wmc-accent-light);
    outline-offset: 2px;
}

.wmc-modal-close:active {
    transform: scale(0.95);
}

/* Type Switcher */
.wmc-type-switcher {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding: 4px;
    background: var(--wmc-gray-100);
    border-radius: var(--wmc-radius);
}

.wmc-type-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--wmc-gray-700);
    font-size: 14px;
    font-weight: 600;
    border-radius: calc(var(--wmc-radius) - 4px);
    cursor: pointer;
    transition: all 0.2s ease;
}

.wmc-type-btn:hover {
    color: var(--wmc-gray-900);
}

.wmc-type-btn.active {
    background: var(--wmc-white);
    color: var(--wmc-accent);
    box-shadow: var(--wmc-shadow);
}

.wmc-type-btn:focus {
    outline: 2px solid var(--wmc-accent);
    outline-offset: -2px;
}

/* Title */
.wmc-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--wmc-gray-900);
    margin: 0 0 24px 0;
}

/* Section */
.wmc-section {
    margin-bottom: 24px;
}

/* Label */
.wmc-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--wmc-gray-700);
    margin-bottom: 8px;
}

.wmc-value-display {
    color: var(--wmc-accent);
    font-weight: 700;
}

/* Select */
.wmc-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--wmc-gray-200);
    border-radius: var(--wmc-radius);
    font-size: 15px;
    color: var(--wmc-gray-900);
    background: var(--wmc-white);
    cursor: pointer;
    transition: all 0.2s ease;
}

.wmc-select:hover {
    border-color: var(--wmc-gray-300);
}

.wmc-select:focus {
    outline: none;
    border-color: var(--wmc-accent);
    box-shadow: 0 0 0 3px var(--wmc-accent-light);
}

/* Examples Grid */
.wmc-examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.wmc-example-btn {
    padding: 16px 12px;
    border: 2px solid var(--wmc-gray-200);
    background: var(--wmc-white);
    border-radius: var(--wmc-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wmc-example-btn:hover {
    border-color: var(--wmc-accent);
    background: var(--wmc-gray-50);
    box-shadow: var(--wmc-shadow);
}

.wmc-example-btn:focus {
    outline: none;
    border-color: var(--wmc-accent);
    box-shadow: 0 0 0 3px var(--wmc-accent-light);
}

.wmc-example-btn.active {
    border-color: var(--wmc-accent);
    background: var(--wmc-accent-light);
}

.wmc-example-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--wmc-gray-900);
}

.wmc-example-area {
    font-size: 13px;
    color: var(--wmc-gray-600);
}

/* Custom Area Input */
.wmc-custom-area label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--wmc-gray-700);
    margin-bottom: 8px;
}

.wmc-custom-area input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--wmc-gray-200);
    border-radius: var(--wmc-radius);
    font-size: 15px;
    transition: all 0.2s ease;
}

.wmc-custom-area input[type="number"]:hover {
    border-color: var(--wmc-gray-300);
}

.wmc-custom-area input[type="number"]:focus {
    outline: none;
    border-color: var(--wmc-accent);
    box-shadow: 0 0 0 3px var(--wmc-accent-light);
}

/* Slider Group */
.wmc-slider-group {
    margin-bottom: 24px;
}

.wmc-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--wmc-gray-200);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    margin: 12px 0;
}

.wmc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--wmc-accent);
    cursor: pointer;
    box-shadow: var(--wmc-shadow);
    transition: all 0.2s ease;
}

.wmc-slider::-webkit-slider-thumb:hover {
    background: var(--wmc-accent-hover);
    transform: scale(1.1);
}

.wmc-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--wmc-accent);
    cursor: pointer;
    border: none;
    box-shadow: var(--wmc-shadow);
    transition: all 0.2s ease;
}

.wmc-slider::-moz-range-thumb:hover {
    background: var(--wmc-accent-hover);
    transform: scale(1.1);
}

.wmc-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px var(--wmc-accent-light), var(--wmc-shadow);
}

.wmc-slider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 3px var(--wmc-accent-light), var(--wmc-shadow);
}

/* Slider track fill effect */
.wmc-slider::-webkit-slider-runnable-track {
    background: linear-gradient(to right, var(--wmc-accent) 0%, var(--wmc-accent) var(--value, 0%), var(--wmc-gray-200) var(--value, 0%), var(--wmc-gray-200) 100%);
    height: 6px;
    border-radius: 3px;
}

.wmc-slider::-moz-range-track {
    background: var(--wmc-gray-200);
    height: 6px;
    border-radius: 3px;
}

.wmc-slider::-moz-range-progress {
    background: var(--wmc-accent);
    height: 6px;
    border-radius: 3px;
}

.wmc-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--wmc-gray-500);
}

/* Counter Group */
.wmc-counter-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.wmc-counter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--wmc-gray-50);
    border-radius: var(--wmc-radius);
}

.wmc-counter-label {
    font-size: 14px;
    color: var(--wmc-gray-800);
    font-weight: 600;
}

.wmc-counter-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wmc-counter-btn {
    min-width: 24px;
    width: 24px;
    max-width: 24px;
    min-height: 24px;
    height: 24px;
    max-height: 24px;
    border: none;
    background: var(--wmc-accent);
    color: var(--wmc-white);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    vertical-align: middle;
}

.wmc-counter-btn:hover {
    background: var(--wmc-accent-hover);
    transform: scale(1.08);
}

.wmc-counter-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--wmc-accent-light);
}

.wmc-counter-btn:active {
    transform: scale(0.92);
}

.wmc-counter-input {
    width: 50px;
    padding: 8px;
    border: 2px solid var(--wmc-gray-200);
    border-radius: calc(var(--wmc-radius) - 4px);
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--wmc-gray-900);
    background: var(--wmc-white);
}

/* Results */
.wmc-results {
    margin: 24px 0;
    padding: 20px;
    background: var(--wmc-gray-50);
    border-radius: var(--wmc-radius);
    border: 2px solid var(--wmc-gray-200);
}

.wmc-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--wmc-gray-200);
}

.wmc-result-item:last-child {
    border-bottom: none;
}

.wmc-result-highlight {
    background: var(--wmc-accent-light);
    margin: 0 -12px;
    padding: 12px;
    border-radius: calc(var(--wmc-radius) - 4px);
    border-bottom: none !important;
}

.wmc-result-label {
    font-size: 14px;
    color: var(--wmc-gray-700);
    font-weight: 500;
}

.wmc-result-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--wmc-gray-900);
}

.wmc-result-highlight .wmc-result-value {
    color: var(--wmc-accent);
    font-size: 20px;
}

/* Coverage Info */
.wmc-coverage-info {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--wmc-gray-50);
    border-radius: var(--wmc-radius);
    margin: 16px 0;
}

.wmc-info-icon {
    flex-shrink: 0;
    color: var(--wmc-gray-500);
    margin-top: 2px;
}

.wmc-coverage-info p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--wmc-gray-600);
}

/* Button Group */
.wmc-button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Buttons */
.wmc-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: var(--wmc-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wmc-btn-primary {
    background: var(--wmc-accent);
    color: var(--wmc-white);
    box-shadow: var(--wmc-shadow);
}

.wmc-btn-primary:hover:not(:disabled) {
    background: var(--wmc-accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--wmc-shadow-lg);
}

.wmc-btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--wmc-accent-light), var(--wmc-shadow);
}

.wmc-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.wmc-btn-primary:disabled {
    background: var(--wmc-gray-300);
    cursor: not-allowed;
    opacity: 0.6;
}

.wmc-btn-secondary {
    background: var(--wmc-white);
    color: var(--wmc-gray-700);
    border: 2px solid var(--wmc-gray-300);
}

.wmc-btn-secondary:hover {
    background: var(--wmc-gray-50);
    border-color: var(--wmc-gray-400);
    color: var(--wmc-gray-900);
}

.wmc-btn-secondary:focus {
    outline: none;
    border-color: var(--wmc-accent);
    box-shadow: 0 0 0 3px var(--wmc-accent-light);
}

.wmc-btn-secondary:active {
    transform: translateY(0);
    background: var(--wmc-gray-100);
}

/* Category Sections */
.wmc-category-section {
    margin-top: 16px;
}

/* Responsive */
@media (max-width: 640px) {
    .wmc-modal {
        padding: 0;
        align-items: flex-end;
    }

    .wmc-modal-container {
        max-width: 100%;
        max-height: 95vh;
        margin: 0;
    }

    .wmc-modal-content {
        border-radius: var(--wmc-radius-lg) var(--wmc-radius-lg) 0 0;
        padding: 24px;
        max-height: 95vh;
    }

    .wmc-modal-title {
        font-size: 20px;
        padding-right: 40px;
    }

    .wmc-examples-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .wmc-counter-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .wmc-type-switcher {
        margin-top: 8px;
    }
}

@media (max-width: 400px) {
    .wmc-examples-grid {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styling */
.wmc-modal-content::-webkit-scrollbar {
    width: 8px;
}

.wmc-modal-content::-webkit-scrollbar-track {
    background: var(--wmc-gray-100);
    border-radius: 4px;
}

.wmc-modal-content::-webkit-scrollbar-thumb {
    background: var(--wmc-gray-400);
    border-radius: 4px;
}

.wmc-modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--wmc-gray-500);
}

/* Print Styles */
@media print {
    .wmc-modal {
        display: none !important;
    }
}
