/**
 * Customer Global Discount - Frontend Styles (Table Layout)
 */

/* Container */
.cgd-my-discounts {
    max-width: 100%;
    margin: 0 auto;
}

/* Sections */
.cgd-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.cgd-section h3 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    font-size: 1.3em;
    color: #1a1a2e;
}

/* Global Discount Section */
.cgd-global-discount {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.cgd-global-discount h3 {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.cgd-discount-badge {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.cgd-discount-value {
    font-size: 2.5em;
    font-weight: 700;
    line-height: 1;
}

.cgd-discount-label {
    font-size: 0.95em;
    opacity: 0.9;
}

.cgd-discount-info {
    margin-top: 15px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.85em;
    opacity: 0.85;
}

.cgd-no-discount {
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    text-align: center;
    opacity: 0.8;
}

/* Product Prices Section */
.cgd-product-prices {
}

.cgd-no-products {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* ==============================================
   TABS COMPONENT
   ============================================== */

.cgd-tabs {
    margin-top: 15px;
}

/* Tabs Navigation */
.cgd-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: #f1f3f5;
    border-radius: 10px;
    margin-bottom: 0;
}

.cgd-tab-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    color: #495057;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cgd-tab-button:hover {
    background: rgba(255, 255, 255, 0.6);
    color: #333;
}

.cgd-tab-button.cgd-tab-active {
    background: #fff;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cgd-tab-icon {
    font-size: 1.2em;
    line-height: 1;
}

.cgd-tab-label {
    display: inline;
}

.cgd-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-radius: 11px;
    font-size: 0.8em;
    font-weight: 600;
}

.cgd-tab-button.cgd-tab-active .cgd-tab-count {
    background: #667eea;
    color: #fff;
}

/* Tabs Content */
.cgd-tabs-content {
    background: #fff;
    border-radius: 0 0 10px 10px;
    border: 1px solid #e9ecef;
    border-top: none;
}

.cgd-tab-panel {
    display: none;
    padding: 0;
}

.cgd-tab-panel.cgd-tab-panel-active {
    display: block;
}

/* Tab panel colors - top accent border */
.cgd-tab-panel[data-tab="artykuly-biurowe"] {
    border-top: 3px solid #3498db;
}

.cgd-tab-panel[data-tab="artykuly-spozywcze"] {
    border-top: 3px solid #27ae60;
}

.cgd-tab-panel[data-tab="srodki-czystosci"] {
    border-top: 3px solid #9b59b6;
}

.cgd-tab-panel[data-tab="uncategorized"] {
    border-top: 3px solid #95a5a6;
}

/* Compact table in tabs */
.cgd-tab-panel .cgd-table-wrapper {
    margin: 0;
}

.cgd-tab-panel .cgd-products-table {
    margin: 0;
}

.cgd-tab-panel .cgd-products-table thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 1;
}

/* Responsive Tabs */
@media (max-width: 768px) {
    .cgd-tabs-nav {
        flex-direction: column;
        gap: 2px;
        padding: 3px;
    }
    
    .cgd-tab-button {
        width: 100%;
        justify-content: flex-start;
        padding: 10px 14px;
    }
    
    .cgd-tab-count {
        margin-left: auto;
    }
}

@media (max-width: 480px) {
    .cgd-tab-label {
        flex: 1;
        text-align: left;
    }
}

/* Legacy Category Sections (kept for backwards compatibility) */
.cgd-category-section {
    margin-bottom: 25px;
    padding: 15px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
}

.cgd-category-section:last-child {
    margin-bottom: 0;
}

.cgd-category-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 1.1em;
    color: #333;
}

.cgd-category-icon {
    font-size: 1.2em;
}

.cgd-category-count {
    font-size: 0.8em;
    font-weight: 400;
    color: #888;
    margin-left: auto;
}

.cgd-no-products-category {
    padding: 12px;
    text-align: center;
    color: #999;
    font-size: 0.9em;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 4px;
}

/* Category Colors */
.cgd-category-section[data-category="artykuly-biurowe"] {
    border-left: 4px solid #3498db;
}

.cgd-category-section[data-category="artykuly-spozywcze"] {
    border-left: 4px solid #27ae60;
}

.cgd-category-section[data-category="srodki-czystosci"] {
    border-left: 4px solid #9b59b6;
}

.cgd-category-section[data-category="uncategorized"] {
    border-left: 4px solid #95a5a6;
}

/* Table Wrapper */
.cgd-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Products Table */
.cgd-products-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.cgd-products-table th,
.cgd-products-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.cgd-products-table thead th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 2px solid #ddd;
}

.cgd-products-table tbody tr:hover {
    background: #f8f9fa;
}

.cgd-products-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Columns */
.cgd-col-sku {
    width: 120px;
}

.cgd-sku-value {
    font-family: monospace;
    font-size: 0.9em;
    color: #666;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
}

.cgd-col-name {
    min-width: 200px;
}

.cgd-col-name .cgd-product-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.cgd-col-name .cgd-product-link:hover {
    color: #667eea;
    text-decoration: underline;
}

.cgd-col-regular,
.cgd-col-custom {
    width: 120px;
    text-align: right;
    white-space: nowrap;
}

.cgd-regular-price {
    color: #999;
    text-decoration: line-through;
    font-size: 0.95em;
}

.cgd-custom-price {
    font-weight: 700;
    color: #667eea;
    font-size: 1.05em;
}

/* Login Required */
.cgd-login-required {
    padding: 20px;
    text-align: center;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
}

.cgd-login-required a {
    color: #533f03;
    font-weight: 600;
}

/* Responsive - Stack on mobile */
@media (max-width: 768px) {
    .cgd-section {
        padding: 15px 10px;
    }
    
    .cgd-discount-badge {
        flex-direction: column;
        gap: 5px;
        padding: 12px 20px;
        text-align: center;
    }
    
    .cgd-discount-value {
        font-size: 2em;
    }
    
    .cgd-category-section {
        padding: 10px;
    }
    
    .cgd-products-table {
        font-size: 0.85em;
    }
    
    .cgd-products-table th,
    .cgd-products-table td {
        padding: 8px 6px;
    }
    
    .cgd-col-sku {
        display: none;
    }
    
    .cgd-col-regular,
    .cgd-col-custom {
        width: auto;
    }
}

/* Hide regular price on very small screens */
@media (max-width: 480px) {
    .cgd-col-regular {
        display: none;
    }
    
    .cgd-products-table thead th.cgd-col-regular {
        display: none;
    }
}

/* Print styles */
@media print {
    .cgd-my-discounts {
        background: #fff;
    }
    
    .cgd-section {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
    
    .cgd-global-discount {
        background: #667eea !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .cgd-category-section {
        break-inside: avoid;
    }
    
    .cgd-products-table tbody tr:hover {
        background: none;
    }
}

/* ==============================================
   /oferta PAGE STYLES
   ============================================== */

.cgd-oferta-page {
    padding: 40px 20px;
    min-height: 60vh;
}

.cgd-oferta-container {
    max-width: 1200px;
    margin: 0 auto;
}

.cgd-oferta-title {
    font-size: 2.5em;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.5em;
    text-align: center;
}

.cgd-oferta-intro {
    font-size: 1.1em;
    color: #666;
    text-align: center;
    margin-bottom: 2em;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cgd-oferta-intro strong {
    color: #667eea;
}

@media (max-width: 768px) {
    .cgd-oferta-page {
        padding: 20px 15px;
    }
    
    .cgd-oferta-title {
        font-size: 1.8em;
    }
    
    .cgd-oferta-intro {
        font-size: 1em;
    }
}

/* ==============================================
   DISCOUNT BANNER SHORTCODE
   [customer_discount_banner]
   ============================================== */

.cgd-discount-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-radius: 10px;
    margin: 15px 0;
    font-size: 0.95em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cgd-discount-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Active banner - user has discount */
.cgd-discount-banner-active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.cgd-discount-banner-active .cgd-banner-icon {
    font-size: 2em;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.cgd-discount-banner-active .cgd-banner-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cgd-discount-banner-active .cgd-banner-greeting {
    font-size: 0.9em;
    opacity: 0.9;
}

.cgd-discount-banner-active .cgd-banner-summary {
    font-size: 1em;
}

.cgd-discount-banner-active .cgd-banner-discount,
.cgd-discount-banner-active .cgd-banner-products {
    display: inline;
}

.cgd-discount-banner-active .cgd-banner-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.2s ease;
    backdrop-filter: blur(10px);
}

.cgd-discount-banner-active .cgd-banner-button:hover {
    background: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.cgd-discount-banner-active .cgd-banner-arrow {
    font-size: 1.1em;
    transition: transform 0.2s ease;
}

.cgd-discount-banner-active .cgd-banner-button:hover .cgd-banner-arrow {
    transform: translateX(4px);
}

/* Login banner */
.cgd-discount-banner-login {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    border: 1px solid #dee2e6;
}

.cgd-discount-banner-login .cgd-banner-icon {
    font-size: 1.8em;
}

.cgd-discount-banner-login .cgd-banner-content {
    flex: 1;
}

.cgd-discount-banner-login .cgd-banner-button {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: #667eea;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.cgd-discount-banner-login .cgd-banner-button:hover {
    background: #5a6fd6;
    color: #fff;
}

/* No discount banner */
.cgd-discount-banner-none {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #e9ecef;
}

.cgd-discount-banner-none .cgd-banner-icon {
    font-size: 1.8em;
    opacity: 0.7;
}

.cgd-discount-banner-none .cgd-banner-content {
    flex: 1;
}

/* Responsive */
@media (max-width: 600px) {
    .cgd-discount-banner {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
        gap: 12px;
    }
    
    .cgd-discount-banner-active .cgd-banner-content {
        align-items: center;
    }
    
    .cgd-discount-banner-active .cgd-banner-button {
        width: 100%;
        justify-content: center;
    }
}
