/**
 * Webstyl Glass Configurator Styles
 * @package Webstyl_Glass_Configurator
 */

/* ============================================
   VARIABLES & BASE
   ============================================ */
:root {
    --wgc-primary: #0073aa;
    --wgc-primary-hover: #005a87;
    --wgc-success: #46b450;
    --wgc-danger: #dc3232;
    --wgc-border: #ddd;
    --wgc-text: #333;
    --wgc-text-light: #666;
    --wgc-bg: #fff;
    --wgc-bg-light: #f9f9f9;
    --wgc-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --wgc-shadow-hover: 0 4px 8px rgba(0,0,0,0.15);
    --wgc-radius: 8px;
    --wgc-transition: all 0.2s ease;
}

/* Zapobiegaj poziomemu scrollowi */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* ============================================
   MAIN CONTAINER - PROFESJONALNY WYGLĄD
   ============================================ */
.wgc-configurator {
    max-width: 1280px;
    margin: 30px auto;
    padding: 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--wgc-text);
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.8);
    overflow-x: hidden;
    box-sizing: border-box;
    width: 100%;
    position: relative;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* Tabs - PROFESJONALNE */
.wgc-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    justify-content: center;
}

.wgc-tab {
    padding: 16px 32px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #000000; /* Czarny tekst na białym tle */
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.wgc-tab::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: #CC0000; /* Czerwony underline */
    transition: width 0.3s ease;
}

.wgc-tab:hover {
    border-color: #CC0000; /* Czerwona bordiura */
    background: #ffffff;
    color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(204,0,0,0.2);
}

.wgc-tab:hover::before {
    width: 100%; /* Czerwony underline na hover */
}

.wgc-tab.active {
    border-color: #000000;
    background: #000000; /* Czarne tło */
    color: #ffffff; /* Biały tekst */
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

.wgc-tab.active::before {
    width: 0; /* Brak underline na aktywnej */
}

.wgc-tab:focus {
    outline: 3px solid #CC0000; /* Czerwony focus ring */
    outline-offset: 2px;
}

/* ============================================
   LAYOUT (2-COLUMN) - PROFESJONALNY
   ============================================ */
.wgc-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    background: rgba(255,255,255,0.7);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.06);
    backdrop-filter: blur(10px);
    overflow: hidden; /* Zapobiegaj overflow */
}

.wgc-preview-panel {
    flex: 1;
    max-width: 720px; /* Górny limit szerokości */
    min-width: 0; /* Pozwól na zwężanie */
    position: sticky;
    top: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.wgc-config-panel {
    flex: 0 0 440px; /* Stała szerokość 440px */
    min-width: 400px; /* Minimum 400px */
    max-width: 440px; /* Maksimum 440px */
    overflow-y: auto; /* Tylko pionowy scroll jeśli potrzebny */
    overflow-x: hidden; /* Wyłącz poziomy scroll */
}

/* Category Content */
.wgc-category-content {
    display: none;
}

.wgc-category-content.active {
    display: block;
}

/* ============================================
   SVG PREVIEW - WIĘKSZY I ŁADNIEJSZY
   ============================================ */
.wgc-svg-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    height: 700px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 3px solid var(--wgc-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin: 0 auto;
    box-sizing: border-box;
}

#wgc-preview-svg {
    display: block;
    width: 100%;
    height: 100%;
}

#wgc-glass-rect {
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.15)) drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    stroke: rgba(255,255,255,0.3);
    stroke-width: 1;
}

/* Ruler Tags */
.wgc-ruler {
    position: absolute;
    z-index: 10;
}

.wgc-ruler-top {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.wgc-ruler-side {
    left: 10px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: center;
}

.wgc-ruler-label {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
}

/* ============================================
   CATEGORY HEADER
   ============================================ */
.wgc-category-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--wgc-text);
}

.wgc-category-desc {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: var(--wgc-text-light);
    margin-top: 5px;
}

/* ============================================
   SECTIONS
   ============================================ */
.wgc-section {
    margin-bottom: 32px;
    padding: 0;
}

.wgc-section:last-child {
    margin-bottom: 0;
}

.wgc-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--wgc-text);
}

/* ============================================
   VARIANT CARDS - PROFESJONALNE
   ============================================ */
.wgc-variants-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Dwie kolumny */
    gap: 15px;
}

.wgc-variant-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid var(--wgc-border);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.wgc-variant-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--wgc-primary), #005a87);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.wgc-variant-card:hover::before {
    transform: scaleX(1);
}

.wgc-variant-card:hover {
    border-color: var(--wgc-primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,115,170,0.15);
    background: linear-gradient(135deg, #ffffff 0%, #e3f2fd 100%);
}

.wgc-variant-card.active {
    border-color: var(--wgc-primary);
    border-width: 3px;
    box-shadow: 0 0 0 4px rgba(0,115,170,0.2);
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    transform: translateY(-2px);
}

.wgc-variant-card.active::before {
    transform: scaleX(1);
}

.wgc-variant-swatch {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    margin: 0 auto 15px;
    border: 3px solid var(--wgc-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
}

.wgc-variant-swatch::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wgc-variant-card:hover .wgc-variant-swatch {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.wgc-variant-card:hover .wgc-variant-swatch::after {
    opacity: 1;
}

.wgc-variant-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--wgc-text);
}

.wgc-variant-price {
    font-size: 14px;
    color: var(--wgc-primary);
    font-weight: 700;
    background: rgba(0,115,170,0.1);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

/* ============================================
   DIMENSIONS
   ============================================ */
.wgc-dimensions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.wgc-dimension-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--wgc-text);
}

.wgc-dimension-field input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--wgc-border);
    border-radius: var(--wgc-radius);
    font-size: 15px;
    transition: var(--wgc-transition);
}

.wgc-dimension-field input[type="number"]:focus {
    outline: none;
    border-color: var(--wgc-primary);
    box-shadow: 0 0 0 3px rgba(0,115,170,0.1);
}

.wgc-dimension-hint {
    font-size: 13px;
    color: var(--wgc-text-light);
    margin: 8px 0 0 0;
}

/* ============================================
   QUANTITY FIELD
   ============================================ */
.wgc-quantity-field {
    max-width: 150px;
}

.wgc-quantity-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--wgc-border);
    border-radius: var(--wgc-radius);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    transition: var(--wgc-transition);
}

.wgc-quantity-input:focus {
    outline: none;
    border-color: var(--wgc-primary);
    box-shadow: 0 0 0 3px rgba(0,115,170,0.1);
}

/* ============================================
   ADDONS
   ============================================ */
.wgc-addons-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wgc-addon-option {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--wgc-bg-light);
    border: 2px solid var(--wgc-border);
    border-radius: var(--wgc-radius);
    cursor: pointer;
    transition: var(--wgc-transition);
}

.wgc-addon-option:hover {
    border-color: var(--wgc-primary);
    background: var(--wgc-bg);
}

.wgc-addon-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

.wgc-addon-label {
    flex: 1;
    font-size: 15px;
    color: var(--wgc-text);
}

.wgc-addon-price {
    color: var(--wgc-text-light);
    font-weight: 500;
}

/* ============================================
   SUMMARY
   ============================================ */
.wgc-summary {
    margin-top: 40px;
    padding: 25px;
    background: var(--wgc-bg-light);
    border: 2px solid var(--wgc-border);
    border-radius: var(--wgc-radius);
}

.wgc-summary-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: var(--wgc-text);
}

.wgc-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.wgc-summary-table td {
    padding: 8px 0;
    font-size: 15px;
}

.wgc-summary-table td:first-child {
    color: var(--wgc-text-light);
}

.wgc-summary-table td:last-child {
    text-align: right;
    font-weight: 500;
}

.wgc-summary-table .wgc-summary-total td {
    padding-top: 15px;
    border-top: 2px solid var(--wgc-border);
    font-size: 18px;
    font-weight: 600;
    color: var(--wgc-text);
}

.wgc-addon-line {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 14px;
    color: var(--wgc-text-light);
}

/* ============================================
   BUTTONS - PROFESJONALNE
   ============================================ */
.wgc-btn-primary {
    width: 100%;
    padding: 18px 40px;
    background: linear-gradient(135deg, #000000 0%, #CC0000 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wgc-btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.wgc-btn-primary:hover::before {
    left: 100%;
}

.wgc-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #CC0000 0%, #000000 100%);
    box-shadow: 0 12px 35px rgba(204,0,0,0.4);
    transform: translateY(-2px);
}

.wgc-btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 6px 20px rgba(204,0,0,0.3);
}

.wgc-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: linear-gradient(135deg, #333 0%, #660000 100%);
    box-shadow: none;
    transform: none;
}

/* ============================================
   MESSAGES
   ============================================ */
.wgc-error-message {
    padding: 12px 15px;
    background: #fff0f0;
    border: 1px solid var(--wgc-danger);
    border-radius: var(--wgc-radius);
    color: var(--wgc-danger);
    margin: 15px 0;
    font-size: 14px;
}

.wgc-woo-notice {
    padding: 12px 15px;
    background: #fff8e5;
    border: 1px solid #ffb900;
    border-radius: var(--wgc-radius);
    color: #666;
    font-size: 14px;
    text-align: center;
}

.wgc-cart-hint {
    margin-top: 12px;
    font-size: 13px;
    color: var(--wgc-text-light);
    text-align: center;
    font-style: italic;
    line-height: 1.4;
}

/* ============================================
   RESPONSIVE (MOBILE) - PROFESJONALNE
   ============================================ */
@media (max-width: 1200px) {
    .wgc-layout {
        gap: 25px;
    }
    
    .wgc-preview-panel {
        flex: 1;
        max-width: 600px;
        min-width: 0;
    }
    
    .wgc-config-panel {
        flex: 0 0 400px;
        min-width: 380px;
        max-width: 400px;
    }
    
    .wgc-svg-container {
        max-width: 600px;
        height: 600px;
    }
}

@media (max-width: 900px) {
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    
    .wgc-configurator {
        padding: 20px;
        margin: 10px;
        border-radius: 16px;
        max-width: calc(100vw - 20px);
        overflow-x: hidden;
    }
    
    .wgc-layout {
        flex-direction: column;
        gap: 30px;
        padding: 20px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .wgc-preview-panel {
        flex: none;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        position: relative;
        top: 0;
        order: 1;
        overflow: hidden;
    }
    
    .wgc-config-panel {
        flex: none;
        width: 100%;
        min-width: auto;
        max-width: 100%;
        order: 2;
        overflow-x: hidden;
    }
    
    .wgc-svg-container {
        width: 100%;
        height: 500px;
        max-width: 500px;
        margin: 0 auto;
        overflow: hidden;
    }
    
    .wgc-dimensions-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .wgc-variants-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

@media (max-width: 600px) {
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        position: relative;
    }
    
    .wgc-configurator {
        padding: 15px;
        margin: 5px;
        border-radius: 12px;
        max-width: calc(100vw - 10px);
        overflow-x: hidden;
    }
    
    .wgc-tabs {
        flex-direction: column;
        gap: 10px;
        max-width: 100%;
    }
    
    .wgc-tab {
        width: 100%;
        padding: 14px 24px;
        font-size: 15px;
    }
    
    .wgc-layout {
        padding: 15px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .wgc-svg-container {
        width: 100%;
        height: 400px;
        max-width: 100%;
        overflow: hidden;
    }
    
    .wgc-variants-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
        max-width: 100%;
    }
    
    .wgc-variant-card {
        padding: 15px;
    }
    
    .wgc-variant-swatch {
        width: 60px;
        height: 60px;
    }
    
    .wgc-btn-primary {
        padding: 16px 30px;
        font-size: 16px;
    }
    
    .wgc-section {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .wgc-dimensions-grid,
    .wgc-summary,
    .wgc-addons-list {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* ============================================
   ELEMENTOR COMPATIBILITY
   ============================================ */
.elementor-widget-shortcode .wgc-configurator {
    /* Ensure proper spacing in Elementor */
    margin-top: 0;
    margin-bottom: 0;
}

.elementor-element .wgc-configurator {
    /* Override Elementor column padding if needed */
    max-width: 100%;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.wgc-variant-card:focus,
.wgc-btn-primary:focus,
.wgc-dimension-field input:focus {
    outline: 3px solid #CC0000;
    outline-offset: 2px;
}

.wgc-addon-option input[type="checkbox"]:focus {
    outline: 2px solid var(--wgc-primary);
    outline-offset: 2px;
}

/* Screen reader only */
.wgc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   EDGE SELECTOR
   ============================================ */
.wgc-edge-selector-wrapper {
    margin-bottom: 30px;
}

.wgc-edge-selector {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-top: 10px;
}

.wgc-edge-preview {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.wgc-edge-middle {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.wgc-edge-center {
    flex: 1;
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border: 2px dashed #adb5bd;
    border-radius: 8px;
    min-height: 100px;
}

.wgc-edge-btn {
    background: #ffffff;
    border: 3px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #495057;
    user-select: none;
}

.wgc-edge-btn:hover {
    background: #e3f2fd;
    border-color: #0073aa;
    color: #0073aa;
    transform: scale(1.05);
}

.wgc-edge-btn.active {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    border-color: #005a87;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

.wgc-edge-top,
.wgc-edge-bottom {
    width: 100%;
    min-height: 50px;
}

.wgc-edge-left,
.wgc-edge-right {
    flex: 0 0 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wgc-edge-left span,
.wgc-edge-right span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.wgc-edge-summary {
    text-align: center;
    font-size: 15px;
    color: #495057;
    padding: 10px;
    background: #ffffff;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.wgc-edge-count {
    color: #0073aa;
    font-size: 18px;
}

/* Podgląd SVG - krawędzie */
.wgc-edge-highlight {
    stroke: #ff0000;
    stroke-width: 4;
    fill: none;
    opacity: 0.8;
}

@media (max-width: 600px) {
    .wgc-edge-left,
    .wgc-edge-right {
        flex: 0 0 60px;
        font-size: 12px;
        padding: 10px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes wgc-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wgc-category-content.active {
    animation: wgc-fadeIn 0.3s ease;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .wgc-tabs,
    .wgc-btn-primary {
        display: none;
    }
    
    .wgc-layout {
        flex-direction: column;
    }
    
    .wgc-summary {
        page-break-inside: avoid;
    }
}

