/* === Dokan Live Stream - Frontend Styles === */

:root {
    --dls-primary: #e67e14;
    --dls-primary-dark: #d35400;
    --dls-primary-light: #fdf2e9;
    --dls-green: #27ae60;
    --dls-text: #1e293b;
    --dls-text-secondary: #64748b;
    --dls-bg: #ffffff;
    --dls-bg-alt: #f8fafc;
    --dls-border: #e2e8f0;
    --dls-radius: 12px;
    --dls-radius-sm: 8px;
    --dls-shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --dls-shadow: 0 4px 6px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.03);
    --dls-shadow-lg: 0 10px 25px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.04);
    --dls-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================
   STREAM GRID - Shortcode [dokan_live_streams]
   ============================================= */

.dls-streams-grid {
    display: grid;
    gap: 28px;
    margin: 24px 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.dls-grid-1 { grid-template-columns: 1fr; }
.dls-grid-2 { grid-template-columns: repeat(2, 1fr); }
.dls-grid-3 { grid-template-columns: repeat(3, 1fr); }
.dls-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* --- Stream Card --- */
.dls-stream-item {
    background: var(--dls-bg);
    border: 1px solid var(--dls-border);
    border-radius: var(--dls-radius);
    overflow: hidden;
    box-shadow: var(--dls-shadow);
    transition: transform var(--dls-transition), box-shadow var(--dls-transition);
    will-change: transform;
    display: flex;
    flex-direction: column;
}

.dls-stream-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--dls-shadow-lg);
}

/* --- Video Wrapper (grid context) --- */
.dls-stream-item .dls-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    background: #000;
    margin: 0;
    border-radius: 0;
    max-width: 100%;
}

.dls-stream-item .dls-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* --- Stream Content (store name + product) --- */
.dls-stream-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dls-store-name {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.dls-store-name a {
    color: var(--dls-text);
    text-decoration: none;
    transition: color var(--dls-transition);
}

.dls-store-name a:hover {
    color: var(--dls-primary);
}

/* --- Product Area --- */
.dls-product-area {
    margin-top: auto;
    min-height: 48px;
}

.dls-loading-text {
    color: var(--dls-text-secondary);
    font-size: 14px;
    margin: 0;
    animation: dls-pulse 1.5s ease-in-out infinite;
}

@keyframes dls-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.dls-no-product {
    color: var(--dls-text-secondary);
    font-size: 13px;
    margin: 0;
    font-style: italic;
}

.dls-error-text {
    color: #dc2626;
    font-size: 13px;
    margin: 0;
}

/* --- Product Card (inside stream) --- */
.dls-product {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--dls-bg-alt);
    border: 1px solid var(--dls-border);
    border-radius: var(--dls-radius-sm);
    transition: border-color var(--dls-transition);
}

.dls-product:hover {
    border-color: var(--dls-primary);
}

.dls-product-image {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: #fff;
}

.dls-product-details {
    flex: 1;
    min-width: 0;
}

.dls-product-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--dls-text);
    margin: 0 0 6px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dls-product-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--dls-green);
    margin-bottom: 8px;
}

.dls-product-price .amount {
    color: inherit;
}

/* --- Add to Cart Button --- */
.dls-add-to-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 36px;
    padding: 8px 16px;
    background: var(--dls-primary);
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none !important;
    transition: background var(--dls-transition), transform var(--dls-transition);
    will-change: transform;
    line-height: 1.3;
    border: none;
    cursor: pointer;
}

.dls-add-to-cart:hover {
    background: var(--dls-primary-dark);
    transform: scale(1.03);
    color: #fff !important;
    text-decoration: none !important;
}

.dls-add-to-cart:active {
    transform: scale(0.97);
}

.dls-add-to-cart:focus-visible {
    outline: 2px solid var(--dls-primary);
    outline-offset: 2px;
}

/* --- No Streams State --- */
.dls-no-streams {
    text-align: center;
    padding: 60px 24px;
    background: var(--dls-bg-alt);
    border: 2px dashed var(--dls-border);
    border-radius: var(--dls-radius);
}

.dls-no-streams-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dls-text);
    margin: 0 0 8px 0;
}

.dls-no-streams-text {
    font-size: 15px;
    color: var(--dls-text-secondary);
    margin: 0;
}

/* =============================================
   SINGLE LIVESTREAM (single-livestream.php)
   ============================================= */

.dls-live-stream-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.dls-live-stream-container .dls-video-wrapper {
    width: 100%;
    padding-bottom: 56.25%;
    margin: 0;
    max-width: 100%;
}

.dls-live-stream-container .dls-product-area {
    margin-top: 16px;
}

.dls-live-stream-container .dls-product {
    max-width: 480px;
}

/* =============================================
   DASHBOARD STYLES (vendor-dashboard-live-stream.php)
   ============================================= */

.dls-unified-container {
    box-sizing: border-box;
}

.dls-dashboard-button-container {
    margin-bottom: 24px;
}

.dls-dashboard-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

/* Stream URL input */
#dls_stream_url {
    max-width: 100%;
    margin-bottom: 10px;
}

#dls_save_url_btn {
    margin-right: 10px;
}

#dls_stream_preview {
    margin-top: 20px;
    display: none;
}

#dls_stream_preview h4 {
    margin-bottom: 10px;
}

#dls_stream_preview .dls-video-wrapper {
    width: 100%;
    max-width: 560px;
    padding-bottom: 56.25%;
    margin: 0;
}

/* Dashboard form group spacing */
.dokan-form-group,
.dokan-dashboard-header,
.dls-dashboard-button-container {
    padding-left: 0;
    padding-right: 0;
}

.dls-product-section {
    padding: 0;
    margin: 32px 0 0;
    clear: both;
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

.dls-product-section .dokan-section-title {
    margin-bottom: 10px;
}

.dls-product-section .description {
    margin-bottom: 20px;
}

/* Product tools (search + filter) */
.dls-product-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.dls-product-search {
    flex: 1 1 320px;
    min-width: 0;
}

.dls-product-filter {
    flex: 0 1 240px;
    min-width: 0;
}

.dls-product-tools label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dls-text);
}

.dls-product-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--dls-text);
}

/* Product table */
.dls-product-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.dls-product-table {
    width: 100%;
    border-collapse: collapse;
}

.dls-product-table thead th {
    padding: 12px 10px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--dls-text);
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.dls-product-table tbody td {
    padding: 12px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #eef2f7;
    color: var(--dls-text);
    font-size: 14px;
}

.dls-product-row:hover {
    background: #fffaf0;
}

.dls-product-row-active {
    background: rgba(230, 126, 20, 0.08);
}

.dls-product-thumb {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff7ed;
    border-radius: 6px;
}

.dls-product-name-text {
    font-weight: 600;
}

.dls-inline-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(230, 126, 20, 0.12);
    color: var(--dls-primary);
    font-size: 11px;
    font-weight: 600;
}

.dls-empty-results {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 14px;
}

.dls-no-products {
    width: 100%;
    text-align: center;
    padding: 60px 20px;
}

.dls-no-products p {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
}

/* =============================================
   RESPONSIVE BREAKPOINTS
   ============================================= */

@media (max-width: 1024px) {
    .dls-grid-4 { grid-template-columns: repeat(3, 1fr); }
    .dls-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .dls-streams-grid {
        gap: 20px;
    }

    .dls-grid-4,
    .dls-grid-3,
    .dls-grid-2 { 
        grid-template-columns: 1fr; 
    }

    .dls-stream-content {
        padding: 16px;
    }

    .dls-store-name {
        font-size: 15px;
    }

    .dls-product {
        gap: 12px;
        padding: 12px;
    }

    .dls-product-image {
        width: 60px;
        height: 60px;
    }

    .dls-product-title {
        font-size: 12px;
    }

    .dls-product-price {
        font-size: 14px;
    }

    .dls-add-to-cart {
        min-height: 40px;
        font-size: 12px;
        padding: 6px 14px;
        width: 100%;
    }

    .dls-live-stream-container .dls-product {
        max-width: 100%;
    }

    .dls-product-tools {
        flex-direction: column;
    }

    .dls-product-search,
    .dls-product-filter {
        flex: 1 1 auto;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .dls-streams-grid {
        gap: 16px;
    }

    .dls-stream-content {
        padding: 12px;
    }

    .dls-product {
        flex-direction: column;
        align-items: flex-start;
    }

    .dls-product-image {
        width: 80px;
        height: 80px;
        align-self: center;
    }

    .dls-product-details {
        width: 100%;
        text-align: center;
    }

    .dls-no-streams {
        padding: 40px 16px;
    }

    .dls-no-streams-title {
        font-size: 17px;
    }
}
