/* ---------------------------------------------------- */
/* 1. CORE LAYOUT & WRAPPER                             */
/* ---------------------------------------------------- */
.ppc-wrapper { 
    max-width: 1200px; 
    margin: 0 auto; 
    font-family: inherit; 
    box-sizing: border-box;
}

/* ---------------------------------------------------- */
/* 2. TABS NAVIGATION                                   */
/* ---------------------------------------------------- */
.ppc-tabs-nav { 
    border-bottom: 2px solid #eee; 
    margin-bottom: 20px; 
}

.ppc-tab-btn {
    background: none; 
    border: none; 
    padding: 15px 20px; 
    font-size: 16px; 
    font-weight: bold; 
    color: #888; 
    cursor: pointer;
    transition: color 0.2s;
}

.ppc-tab-btn.active { 
    color: #000; 
    border-bottom: 3px solid #000; 
}

.ppc-tab-btn:hover {
    color: #333;
}

/* ---------------------------------------------------- */
/* 3. DASHBOARD CONTAINER                               */
/* ---------------------------------------------------- */
.ppc-dashboard { 
    display: flex; 
    border: 1px solid #ddd; 
    border-radius: 8px; 
    overflow: hidden; 
    min-height: 500px; 
    background: #fff;
}

.ppc-sidebar { 
    width: 30%; 
    background: #f9f9f9; 
    border-right: 1px solid #ddd; 
}

.ppc-display-area { 
    width: 70%; 
    padding: 30px; 
    background: #fff; 
}

/* ---------------------------------------------------- */
/* 4. SCROLLABLE SIDEBAR MENU (New Feature)             */
/* ---------------------------------------------------- */
.ppc-list { 
    list-style: none; 
    padding: 0; 
    margin: 0;
    
    /* Enable Vertical Scroll */
    overflow-y: auto; 
    
    /* PC Height: Approx 50px per item * 8 items = 400px */
    height: 400px; 
    
    /* Smooth Scroll */
    scroll-behavior: smooth;
    
    /* Custom Scrollbar Styling (Webkit) */
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

/* Custom Scrollbar for Chrome/Safari */
.ppc-list::-webkit-scrollbar { width: 6px; }
.ppc-list::-webkit-scrollbar-track { background: #f1f1f1; }
.ppc-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.ppc-list::-webkit-scrollbar-thumb:hover { background: #999; }

.ppc-item { 
    padding: 15px 20px; 
    border-bottom: 1px solid #eee; 
    cursor: pointer; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    transition: background 0.2s;
}

.ppc-item:hover, .ppc-item.active { 
    background: #000; 
    color: #fff; 
}

/* ---------------------------------------------------- */
/* 5. CONTENT STYLING                                   */
/* ---------------------------------------------------- */
.ppc-placeholder, .ppc-loading { 
    text-align: center; 
    color: #999; 
    margin-top: 50px; 
}

/* Spinner Animation */
@keyframes ppc-spin { 100% { transform: rotate(360deg); } }
.dashicons.spin { animation: ppc-spin 1.5s infinite linear; }

/* Headers & Badges */
.ppc-meta-header { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    margin-bottom: 20px; 
    align-items: center; 
}

.ppc-badge-length { 
    background: #222; 
    color: #fff; 
    padding: 5px 12px; 
    border-radius: 4px; 
    font-weight: bold; 
    font-size: 13px; 
    display: inline-flex; 
    align-items: center; 
    gap: 5px; 
}

.ppc-badge-length .dashicons { 
    font-size: 16px; width: 16px; height: 16px; color: #ffd700; 
}

.ppc-tags { margin-bottom: 5px; }
.ppc-tag { 
    background: #e0f7fa; 
    color: #006064; 
    padding: 4px 10px; 
    border-radius: 12px; 
    font-size: 12px; 
    margin-right: 5px; 
}

/* Group Headers */
.ppc-substance-group { 
    margin-bottom: 30px; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 20px; 
}
.ppc-substance-group h4 { 
    margin-bottom: 15px; 
    color: #555; 
    text-transform: uppercase; 
    font-size: 14px; 
    letter-spacing: 0.5px; 
}

/* Stats Grid */
.ppc-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px; 
    margin: 20px 0; 
}
.ppc-box { 
    background: #f5f5f5; 
    padding: 15px; 
    border-radius: 5px; 
    text-align: center; 
}
.ppc-box small { text-transform: uppercase; color: #666; font-size: 10px; }
.ppc-box div { font-weight: bold; font-size: 16px; margin-top: 5px; }

/* Tables */
.ppc-table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.ppc-table th { background: #eee; text-align: left; padding: 10px; }
.ppc-table td { border-bottom: 1px solid #eee; padding: 10px; }

/* Smart Links (Used In Cycle) */
.ppc-linked-cycles-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.ppc-smart-link { 
    background: #f0f0f1; 
    border: 1px solid #ddd; 
    padding: 10px 15px; 
    border-radius: 4px; 
    cursor: pointer; 
    transition: all 0.2s; 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    color: #333; 
}
.ppc-smart-link:hover { background: #000; color: #fff; border-color: #000; }
.ppc-smart-link .dashicons { font-size: 18px; width: 18px; height: 18px; }

/* ---------------------------------------------------- */
/* 6. PRODUCTS GRID (Desktop)                           */
/* ---------------------------------------------------- */
.ppc-prod-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
    gap: 15px; 
    margin-top: 15px; 
    /* Ensures equal height cards */
    align-items: stretch; 
}

.ppc-prod-card { 
    border: 1px solid #eee; 
    padding: 10px; 
    text-align: center; 
    border-radius: 5px; 
    background: #fff;
    min-width: 0;
    
    /* Flexbox for sticky footer */
    display: flex;
    flex-direction: column; 
    height: 100%; 
}

.ppc-prod-card img { 
    width: 100%; 
    height: auto; 
    margin-bottom: 10px; 
    border-radius: 4px; 
    object-fit: contain;
}

/* Title: Strict 3 lines */
.ppc-prod-card h4 { 
    font-size: 14px; 
    line-height: 1.4em;
    height: 4.2em;      
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    margin: 5px 0 10px 0;
}

.ppc-price { font-weight: bold; margin-bottom: 5px; color: #000; }

/* Button: Sticky Bottom */
.ppc-btn { 
    display: block; 
    background: #000; 
    color: #fff; 
    text-decoration: none; 
    padding: 8px; 
    border-radius: 4px; 
    font-size: 12px; 
    margin-top: auto; /* Push to bottom */
    transition: background 0.2s;
}
.ppc-btn:hover { background: #333; color: #fff; }

/* AJAX States */
.ppc-loading-btn {
    opacity: 0.7;
    cursor: wait;
    background: #555 !important;
}
.ppc-added-btn {
    background: #28a745 !important; /* Green */
    color: #fff !important;
    border-color: #28a745 !important;
    pointer-events: none;
}
.ppc-added-btn .dashicons { font-size: 14px; width: 14px; height: 14px; vertical-align: middle; margin-right: 3px; }

/* ---------------------------------------------------- */
/* 7. MOBILE RESPONSIVE (Max Width 768px)               */
/* ---------------------------------------------------- */
@media (max-width: 768px) {
    .ppc-dashboard { flex-direction: column; }
    
    .ppc-sidebar { 
        width: 100%; 
        border-bottom: 1px solid #ddd; 
        border-right: none;
    }

    /* Shorter List on Mobile (Approx 5 items) */
    .ppc-list {
        height: 250px; 
    }

    .ppc-display-area { width: 100%; padding: 20px 15px; }

    /* SWIPE CONTAINER FIX */
    .ppc-swipe-container {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 15px;
        padding-bottom: 15px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        grid-template-columns: none !important;
        align-items: stretch;
    }

    .ppc-prod-card {
        flex: 0 0 160px !important;
        width: 160px !important;
        max-width: 160px !important;
        scroll-snap-align: start;
        margin-right: 0;
        height: auto; 
    }
}
