/* =========================================
   TOOL ĐÃ MUA – dashboard-bought.css
   ========================================= */

/* ---- Page wrapper ---- */
.bought-page {
    padding: 32px 0 80px;
    min-height: calc(100vh - 64px);
}

/* ---- Breadcrumb ---- */
.bought-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-soft);
    margin-bottom: 12px;
}

.bought-breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.bought-breadcrumb a:hover { text-decoration: underline; }

/* ---- Page header ---- */
.bought-header { margin-bottom: 24px; }

.bought-header-main {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.bought-header-main h1 {
    font-size: 1.55rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.bought-header-main p {
    font-size: 0.9rem;
    color: var(--text-soft);
}

.bought-cta { gap: 6px; flex-shrink: 0; }

/* ---- Toolbar: stats + controls ---- */
.bought-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    margin-bottom: 24px;
}

/* stats */
.bought-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.bought-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bought-stat-num {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.bought-stat-label {
    font-size: 0.75rem;
    color: var(--text-soft);
}

.bought-stat-divider {
    width: 1px;
    height: 36px;
    background: var(--border-subtle);
}

/* controls */
.bought-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bought-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.bought-search-icon {
    position: absolute;
    left: 11px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0.5;
}

.bought-search {
    padding: 8px 12px 8px 32px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.88rem;
    width: 210px;
    transition: var(--transition-fast);
    font-family: inherit;
}

.bought-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    width: 240px;
}

.bought-search::placeholder { color: var(--text-soft); }

.bought-sort {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition-fast);
}

.bought-sort:focus {
    outline: none;
    border-color: var(--accent);
}

.bought-sort option { background: var(--bg-elevated); }

/* view toggle */
.view-toggle {
    display: inline-flex;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.view-toggle-btn {
    border: none;
    background: transparent;
    color: var(--text-soft);
    padding: 7px 10px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.view-toggle-btn:hover { color: var(--text-main); background: var(--bg-elevated-soft, rgba(255,255,255,0.06)); }

.view-toggle-btn.is-active {
    background: var(--accent);
    color: #fff;
}

/* ---- Tools list container ---- */
.tools-list {
    display: grid;
    gap: 14px;
}

.tools-list--grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.tools-list--list {
    grid-template-columns: 1fr;
}

/* ---- Tool card ---- */
.bought-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition-normal);
    position: relative;
}

.bought-card:hover {
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    transform: translateY(-2px);
}

/* Thumbnail */
.tool-card-thumb {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: linear-gradient(135deg, #1e1b4b 0%, #1e3a5f 100%);
    flex-shrink: 0;
    position: relative;
}

.tool-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.bought-card:hover .tool-card-thumb img { transform: scale(1.05); }

/* Body */
.tool-card-body {
    flex: 1;
    padding: 16px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-soft);
    flex-wrap: wrap;
}

.tool-category {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-light, #a5b4fc);
    font-weight: 500;
    font-size: 0.72rem;
}

.order-date { color: var(--text-soft); }

.tool-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
    margin: 0;
}

.tool-card-seller {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.seller-avatar-xs {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

/* License key */
.license-key-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    border: 1px dashed rgba(99, 102, 241, 0.35);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.license-label {
    font-size: 0.72rem;
    color: var(--text-soft);
    flex-shrink: 0;
}

.license-key {
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: 0.78rem;
    color: #a5b4fc;
    letter-spacing: 0.06em;
    flex: 1;
    word-break: break-all;
    cursor: pointer;
    user-select: all;
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.88rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: var(--transition-fast);
    flex-shrink: 0;
    opacity: 0.7;
}

.copy-btn:hover {
    opacity: 1;
    background: var(--accent-soft);
}

/* Actions row */
.tool-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 16px 12px;
}

.card-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid var(--border-subtle);
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}

.card-action-icon { font-size: 0.95rem; line-height: 1; }

.card-action-download {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.card-action-download:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.6);
    transform: translateY(-1px);
}

.card-action-download:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.card-action-no-file {
    background: rgba(100, 116, 139, 0.08) !important;
    border-color: rgba(100, 116, 139, 0.2) !important;
    color: var(--text-soft) !important;
    cursor: not-allowed !important;
}

@keyframes slideInToast {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card-action-chat {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
}

.card-action-chat:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
}

/* Footer */
.tool-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.12);
    gap: 10px;
}

.order-amount {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-light, #a5b4fc);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

/* ---- LIST VIEW adaptation ---- */
.tools-list--list .bought-card {
    flex-direction: row;
    align-items: stretch;
}

.tools-list--list .tool-card-thumb {
    width: 120px;
    height: auto;
    min-height: 100px;
    flex-shrink: 0;
    border-radius: 0;
}

.tools-list--list .tool-card-body {
    padding: 14px 16px 10px;
}

.tools-list--list .tool-card-actions {
    padding: 0 14px 12px;
}

.tools-list--list .tool-card-footer {
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    border-top: none;
    border-left: 1px solid var(--border-subtle);
    padding: 16px;
    min-width: 130px;
    gap: 8px;
    background: rgba(0, 0, 0, 0.1);
}

/* ---- Skeleton loading ---- */
.skeleton {
    background: linear-gradient(90deg,
        var(--bg-elevated) 0%,
        rgba(255,255,255,0.06) 50%,
        var(--bg-elevated) 100%);
    background-size: 300% 100%;
    animation: shimmer 1.4s infinite ease-in-out;
    border-radius: var(--radius-sm);
}

.skeleton-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.skeleton-thumb {
    width: 100%;
    height: 160px;
    display: block;
}

.skeleton-line { display: block; }

@keyframes shimmer {
    0%   { background-position: 300% 0; }
    100% { background-position: -300% 0; }
}

/* ---- Empty state ---- */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 24px;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 12px 0 8px;
}

.empty-state p {
    font-size: 0.9rem;
    color: var(--text-soft);
}

/* ---- Error state ---- */
.error-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 24px;
    color: var(--text-soft);
    font-size: 0.9rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .bought-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding: 14px 16px;
    }

    .bought-controls { width: 100%; }

    .bought-search { width: 100%; flex: 1; }
    .bought-search:focus { width: 100%; }

    .bought-search-wrap { flex: 1; }

    .tools-list--list .bought-card { flex-direction: column; }
    .tools-list--list .tool-card-thumb { width: 100%; height: 160px; }
    .tools-list--list .tool-card-actions { grid-template-columns: 1fr 1fr; padding: 0 14px 12px; }
    .tools-list--list .tool-card-footer {
        flex-direction: row;
        border-left: none;
        border-top: 1px solid var(--border-subtle);
        justify-content: space-between;
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .bought-header-main { flex-direction: column; align-items: flex-start; }
    .bought-stat-num { font-size: 1.1rem; }
    .tools-list--grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .bought-card, .tool-card-thumb img, .skeleton { transition: none; animation: none; }
}
