/* TianDe Video Reviews - Admin Styles */

:root {
    --primary-color: #e91e63;
    --secondary-color: #9c27b0;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --pending-color: #ff9800;
    --approved-color: #4caf50;
    --rejected-color: #f44336;
    --text-color: #333;
    --border-color: #e0e0e0;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 24px;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.stats-bar {
    display: flex;
    gap: 30px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-label {
    font-size: 14px;
    color: #666;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
}

.stat-value.pending { color: var(--pending-color); }
.stat-value.approved { color: var(--approved-color); }
.stat-value.rejected { color: var(--rejected-color); }

/* Media Tabs */
.media-tabs {
    display: flex;
    gap: 0;
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.media-tab {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.media-tab:hover {
    background: #f5f5f5;
    color: var(--primary-color);
}

.media-tab.active {
    background: #fff;
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filters {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #c2185b;
}

.btn-secondary {
    background: white;
    border: 2px solid var(--border-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    background: #ffebee;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

/* Media List */
.media-list {
    display: block;
}

/* Reviews Table (row-based list) */
.reviews-table {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

.reviews-header {
    display: grid;
    grid-template-columns: 110px 1.6fr 140px 140px 1.2fr 170px 120px;
    gap: 12px;
    padding: 12px 14px;
    background: #fafafa;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.review-row {
    display: grid;
    grid-template-columns: 110px 1.6fr 140px 140px 1.2fr 170px 120px;
    gap: 12px;
    padding: 12px 14px;
    align-items: start;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.review-row:hover {
    background: #fbfbfc;
}

.reviews-body .review-row:last-child {
    border-bottom: none;
}

.col-author,
.col-product {
    min-width: 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--border-color);
    background: #fff;
    white-space: nowrap;
}

.status-pill.pending {
    background: #fff3e0;
    border-color: rgba(255, 152, 0, 0.35);
    color: #e65100;
}

.status-pill.approved {
    background: #e8f5e9;
    border-color: rgba(76, 175, 80, 0.35);
    color: #1b5e20;
}

.status-pill.rejected {
    background: #ffebee;
    border-color: rgba(244, 67, 54, 0.35);
    color: #b71c1c;
}

.author-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    min-width: 0;
}

.author-name {
    font-weight: 700;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    color: white;
    font-size: 12px;
    font-weight: 800;
    flex: 0 0 auto;
}

.row-comment {
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-comment--empty {
    color: #999;
    font-style: italic;
}

.rating-stars {
    font-size: 14px;
    letter-spacing: 0.08em;
    color: #f59e0b;
    white-space: nowrap;
}

.media-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--border-color);
    background: #fafafa;
    color: #444;
    white-space: nowrap;
}

.col-product {
    font-size: 13px;
    color: #444;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.date-line {
    font-size: 12px;
    color: #444;
    white-space: nowrap;
}

.market-line {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
}

@media (max-width: 1100px) {
    .reviews-header,
    .review-row {
        grid-template-columns: 110px 1.8fr 140px 140px 170px 120px;
    }
    .col-product {
        display: none;
    }
}

@media (max-width: 860px) {
    .reviews-header,
    .review-row {
        grid-template-columns: 110px 1fr 140px 170px 120px;
    }
    .col-rating,
    .col-media {
        display: none;
    }
}

/* Media Card */
.media-card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.media-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.media-card.status-pending {
    border-left: 4px solid var(--pending-color);
}

.media-card.status-approved {
    border-left: 4px solid var(--approved-color);
}

.media-card.status-rejected {
    border-left: 4px solid var(--rejected-color);
}

.media-thumbnail {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    cursor: pointer;
    background: #f0f0f0;
}

.media-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.media-badge.video {
    background: rgba(25, 118, 210, 0.9);
    color: white;
}

.media-badge.photo {
    background: rgba(123, 31, 162, 0.9);
    color: white;
}

.play-overlay,
.zoom-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(233, 30, 99, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.2s;
}

.media-thumbnail:hover .play-overlay,
.media-thumbnail:hover .zoom-overlay {
    opacity: 1;
}

.media-info {
    padding: 16px;
}

.media-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.media-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
    word-break: break-word;
}

.media-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 10px;
    flex-shrink: 0;
}

.media-status.pending {
    background: #fff3e0;
    color: var(--pending-color);
}

.media-status.approved {
    background: #e8f5e9;
    color: var(--approved-color);
}

.media-status.rejected {
    background: #ffebee;
    color: var(--rejected-color);
}

.media-author {
    font-size: 14px;
    color: #1a73e8;
    font-weight: 500;
    margin-bottom: 6px;
}

.media-rating {
    font-size: 18px;
    margin-bottom: 8px;
}

.media-comment {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    font-style: italic;
}

.media-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
}

.media-product {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-bottom: 12px;
}

.media-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.media-actions .btn {
    flex: 1;
    font-size: 13px;
    padding: 8px 12px;
}

/* Modal Image */
.modal-media {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 20px;
}

.modal-media.modal-image {
    max-height: 60vh;
    object-fit: contain;
}

iframe.modal-media {
    aspect-ratio: 16/9;
    transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.video-card.status-pending {
    border-left: 4px solid var(--pending-color);
}

.video-card.status-approved {
    border-left: 4px solid var(--approved-color);
}

.video-card.status-rejected {
    border-left: 4px solid var(--rejected-color);
}

.video-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
}

.video-info {
    padding: 16px;
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.video-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
}

.video-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.video-status.pending {
    background: #fff3e0;
    color: var(--pending-color);
}

.video-status.approved {
    background: #e8f5e9;
    color: var(--approved-color);
}

.video-status.rejected {
    background: #ffebee;
    color: var(--rejected-color);
}

.video-rating {
    font-size: 18px;
    margin-bottom: 8px;
}

.video-comment {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    font-style: italic;
}

.video-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
}

.video-product {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-bottom: 12px;
}

.product-code-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.product-code-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.product-info {
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    margin-bottom: 8px;
}

.product-name {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.product-price {
    color: var(--primary-color);
    font-weight: 600;
}

.video-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.video-actions .btn {
    flex: 1;
    font-size: 13px;
    padding: 8px 12px;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    z-index: 3;
    background: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.modal-close:hover {
    color: #333;
}

#modal-body {
    padding: 20px;
}

/* Modal toolbar */
.modal-toolbar {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

/* Detail editor */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    padding-right: 48px;
}

.detail-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--text-color);
}

.detail-sub {
    margin-top: 6px;
    color: #777;
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-right: 48px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 16px;
    align-items: start;
}

.detail-panel {
    background: #fafafa;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
}

.detail-section + .detail-section {
    margin-top: 16px;
}

.detail-section-title {
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.02em;
    color: #555;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.detail-media-empty {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border: 1px dashed #ddd;
    border-radius: 10px;
    color: #777;
}

.detail-media-empty-icon {
    font-size: 30px;
}

.media-type-badge {
    position: absolute;
    left: 6px;
    bottom: 6px;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    color: white;
    background: rgba(0, 0, 0, 0.55);
}

.media-type-badge.video {
    background: rgba(26, 115, 232, 0.9);
}

.detail-form {
    display: grid;
    gap: 12px;
}

.form-row label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #555;
    margin-bottom: 6px;
}

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    background: white;
}

.form-row .input-sm {
    width: 220px;
    max-width: 100%;
}

.form-row textarea {
    resize: vertical;
    min-height: 96px;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}

.checkbox-inline input {
    width: auto;
}

.form-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-inline select {
    width: auto;
    min-width: 90px;
}

.form-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #777;
}

.detail-media-upload {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.detail-media-upload input[type="file"] {
    flex: 1 1 240px;
}

.product-preview {
    margin-top: 10px;
    background: white;
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    padding: 10px 12px;
}

.product-preview-name {
    font-weight: 800;
    color: #333;
}

.product-preview-price {
    margin-top: 4px;
    font-weight: 700;
    color: var(--primary-color);
}

.product-preview-link {
    display: inline-block;
    margin-top: 6px;
    color: #1a73e8;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.product-preview-link:hover {
    text-decoration: underline;
}

.detail-meta {
    margin-top: 12px;
    display: grid;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #e6e6e6;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    color: #444;
}

.meta-row span:first-child {
    color: #777;
}

@media (max-width: 900px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.modal-video {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Confirm Dialog */
.confirm-overlay {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-box {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: confirmIn 0.2s ease;
}

@keyframes confirmIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.confirm-box p {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-buttons .btn {
    min-width: 80px;
}

/* Responsive */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .filters {
        flex-wrap: wrap;
    }

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

    .stats-bar {
        flex-wrap: wrap;
        gap: 15px;
    }

    .video-actions {
        flex-direction: column;
    }
}
