/**
 * Nadigi Tools List - Frontend Styles
 * Version: 1.0.0
 * Author: Trong Nhan Digital
 * 
 * Desktop: Table layout | Mobile: Cards with labeled sections
 * Prefix: ndt- (Nadigi Tools)
 */

/* === Variables - Brand Colors === */
.ndt-wrap {
    /* Brand Colors */
    --ndt-yellow: #FFD100;
    --ndt-yellow-hover: #e6bc00;
    --ndt-black: #1F1E1C;
    --ndt-white: #FFFFFF;
    --ndt-dark-gray: #323232;
    --ndt-gray: #808080;
    --ndt-gray-90: #C5C5C5;
    --ndt-gray-70: #D4D4D4;
    --ndt-gray-50: #EBEBEB;
    --ndt-gray-30: #F1F1F1;
    --ndt-gray-10: #F6F6F7;
    --ndt-red: #dc2626;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ndt-black);
    line-height: 1.6;
    box-sizing: border-box;
}

.ndt-wrap *,
.ndt-wrap *::before,
.ndt-wrap *::after {
    box-sizing: inherit;
}

/* === Filter Bar === */
.ndt-wrap .ndt-filter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 15px;
    padding: 16px 20px;
    background: var(--ndt-gray-10);
    border-radius: 8px;
}

.ndt-wrap .ndt-filter-left {
    display: flex;
    align-items: center;
}

.ndt-wrap .ndt-filter-right {
    display: flex;
    align-items: center;
}

.ndt-wrap .ndt-select {
    padding: 10px 36px 10px 14px;
    border: 1px solid var(--ndt-gray-70);
    border-radius: 6px;
    font-size: 14px;
    color: var(--ndt-black);
    background: var(--ndt-white) url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%236b7280" stroke-width="2"><polyline points="6 9 12 15 18 9"></polyline></svg>') no-repeat right 12px center;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

.ndt-wrap .ndt-select:hover,
.ndt-wrap .ndt-select:focus {
    border-color: var(--ndt-yellow);
    outline: none;
}

/* Tool Count */
.ndt-wrap .ndt-tool-count {
    font-size: 14px;
    color: var(--ndt-gray);
}

.ndt-wrap .ndt-tool-count strong {
    color: var(--ndt-black);
    font-weight: 600;
}

/* ================================
   DESKTOP TABLE (TheCMO Style)
================================ */
.ndt-wrap .ndt-table-wrap {
    display: block;
    background: var(--ndt-white);
    border-radius: 8px;
    overflow: hidden;
}

.ndt-wrap .ndt-table {
    width: 100%;
    border-collapse: collapse;
}

/* Table Header */
.ndt-wrap .ndt-table thead th {
    padding: 16px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ndt-gray);
    border-bottom: 2px solid var(--ndt-gray-70);
    background: transparent;
}

.ndt-wrap .ndt-th-tool {
    width: 24%;
}

.ndt-wrap .ndt-th-cat {
    width: 12%;
}

.ndt-wrap .ndt-th-desc {
    width: 28%;
}

.ndt-wrap .ndt-th-price {
    width: 22%;
}

.ndt-wrap .ndt-th-action {
    width: 12%;
    text-align: right;
}

/* Table Rows */
.ndt-wrap .ndt-row {
    border-bottom: 1px solid var(--ndt-gray-70);
    background: var(--ndt-white);
}

.ndt-wrap .ndt-row:last-child {
    border-bottom: 2px solid var(--ndt-gray-70);
}

.ndt-wrap .ndt-row td {
    padding: 20px;
    vertical-align: top;
}

/* Tool Column */
.ndt-wrap .ndt-tool-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ndt-wrap .ndt-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
}

.ndt-wrap .ndt-logo-ph {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--ndt-yellow), #10b981);
    color: var(--ndt-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    flex-shrink: 0;
}

.ndt-wrap .ndt-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--ndt-black);
}

/* Category Column */
.ndt-wrap .ndt-td-cat {
    font-size: 14px;
    color: var(--ndt-black);
}

/* Description Column */
.ndt-wrap .ndt-desc-text {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--ndt-black);
    line-height: 1.5;
}

/* Yellow Underline Link - Black underline on hover */
.ndt-wrap .ndt-link-yellow {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ndt-black);
    text-decoration: none;
    border-bottom: 2px solid var(--ndt-yellow);
    transition: border-color 0.15s;
}

.ndt-wrap .ndt-link-yellow:hover {
    border-color: var(--ndt-black);
}

/* Price Column */
.ndt-wrap .ndt-price-text {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--ndt-black);
}

/* Coupon Box - Copy button on separate line */
.ndt-wrap .ndt-coupon-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ndt-wrap .ndt-coupon-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ndt-wrap .ndt-code {
    background: #FFF3E0;
    color: #f75b00;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    font-family: monospace;
    border: 1px dashed #f75b00;
}

.ndt-wrap .ndt-discount {
    color: #f75b00;
    font-size: 13px;
    font-weight: 700;
}

.ndt-wrap .ndt-copy-btn {
    display: inline-block;
    padding: 6px 14px;
    background: var(--ndt-white);
    border: 1px solid var(--ndt-gray-70);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ndt-black);
    cursor: pointer;
    transition: all 0.15s;
    width: fit-content;
}

.ndt-wrap .ndt-copy-btn:hover {
    background: var(--ndt-black);
    color: var(--ndt-white);
    border-color: var(--ndt-black);
}

.ndt-wrap .ndt-copy-btn.copied {
    background: var(--ndt-yellow);
    color: var(--ndt-black);
    border-color: var(--ndt-yellow);
}

/* Yellow Button */
.ndt-wrap .ndt-btn-green {
    display: inline-block;
    padding: 10px 20px;
    background: var(--ndt-yellow);
    color: var(--ndt-black);
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s;
}

.ndt-wrap .ndt-btn-green:hover {
    background: var(--ndt-yellow-hover);
    color: var(--ndt-black);
}

.ndt-wrap .ndt-td-action {
    text-align: right;
    vertical-align: middle !important;
}

/* ================================
   MOBILE CARDS (TheCMO Style)
================================ */
.ndt-wrap .ndt-cards {
    display: none;
}

.ndt-wrap .ndt-card {
    background: var(--ndt-white);
    margin-bottom: 0;
    padding-bottom: 20px;
    padding-top: 20px;
    border-bottom: 1px solid var(--ndt-gray-70);
}

.ndt-wrap .ndt-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Card Header */
.ndt-wrap .ndt-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
}

.ndt-wrap .ndt-card-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--ndt-black);
}

.ndt-wrap .ndt-card-logo {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: contain;
}

.ndt-wrap .ndt-card-logo-ph {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--ndt-yellow), #10b981);
    color: var(--ndt-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 24px;
}

/* Card Body - Contains all sections without internal borders */
.ndt-wrap .ndt-card-body {
    padding: 0;
}

/* Card Sections - No borders */
.ndt-wrap .ndt-card-section {
    padding: 12px 0;
}

.ndt-wrap .ndt-section-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ndt-gray);
    margin-bottom: 6px;
}

.ndt-wrap .ndt-section-text {
    margin: 0;
    font-size: 15px;
    color: var(--ndt-black);
    line-height: 1.5;
}

/* Mobile Coupon - Same row as code since mobile is wide enough */
.ndt-wrap .ndt-coupon-mobile {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}

/* Card Footer */
.ndt-wrap .ndt-card-footer {
    padding: 20px 0;
}

.ndt-wrap .ndt-card-footer .ndt-btn-green {
    display: block;
    text-align: center;
}

/* ================================
   UTILITIES
================================ */

/* Toast Notification */
.ndt-wrap .ndt-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1f2937;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
}

.ndt-wrap .ndt-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Empty State */
.ndt-wrap .ndt-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--ndt-gray);
    font-style: italic;
    background: var(--ndt-white);
    border-radius: 8px;
}

/* Loading State */
.ndt-wrap .ndt-container.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ================================
   RESPONSIVE - TABLET & MOBILE
================================ */
@media (max-width: 900px) {

    /* Hide table, show cards */
    .ndt-wrap .ndt-table-wrap {
        display: none;
    }

    .ndt-wrap .ndt-cards {
        display: block;
    }

    .ndt-wrap .ndt-filter {
        gap: 12px;
    }

    .ndt-wrap .ndt-select {
        width: auto;
    }

    .ndt-wrap .ndt-card-header {
        padding: 0;
    }

    .ndt-wrap .ndt-card-name {
        font-size: 16px;
    }

    .ndt-wrap .ndt-card-logo,
    .ndt-wrap .ndt-card-logo-ph {
        width: 48px;
        height: 48px;
    }

    .ndt-wrap .ndt-card-body {
        padding: 0;
    }

    .ndt-wrap .ndt-card-footer {
        padding: 14px 0 0 0;
    }
}