/**
 * Admin Panel CSS - Minimalist & Functional
 */

:root {
    --admin-bg: #f8fafc;
    --admin-card: #ffffff;
    --admin-text: #0f172a;
    --admin-muted: #64748b;
    --admin-border: #e2e8f0;
    --admin-primary: #0f172a;
    --admin-accent: #ee4d2d;
    --admin-danger: #ef4444;
    --admin-success: #10b981;
}

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

body {
    background-color: var(--admin-bg);
    color: var(--admin-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.admin-header {
    background: #0f172a;
    color: #fff;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-header a {
    color: #fff;
    text-decoration: none;
}

.admin-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.admin-nav a {
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
}

.admin-nav a:hover {
    color: #fff;
}

.admin-container {
    max-width: 1200px;
    margin: 32px auto;
    padding: 0 20px;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 20px;
}

.stat-card h3 {
    font-size: 13px;
    text-transform: uppercase;
    color: var(--admin-muted);
    margin-bottom: 8px;
}

.stat-card .number {
    font-size: 28px;
    font-weight: 700;
    color: var(--admin-text);
}

/* Action Header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.panel-title {
    font-size: 24px;
    font-weight: 700;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--admin-primary);
    color: #fff;
}

.btn-primary:hover {
    background: #1e293b;
}

.btn-shopee {
    background: var(--admin-accent);
    color: #fff;
}

.btn-shopee:hover {
    background: #d73211;
}

.btn-outline {
    background: #fff;
    border-color: var(--admin-border);
    color: var(--admin-text);
}

.btn-outline:hover {
    background: #f1f5f9;
}

.btn-danger {
    background: #fee2e2;
    color: var(--admin-danger);
    border-color: #fca5a5;
}

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

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* Table */
.table-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th {
    background: #f8fafc;
    padding: 12px 18px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--admin-muted);
    border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--admin-border);
    vertical-align: middle;
}

.admin-table tr:hover {
    background: #fbfcfe;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-published {
    background: #dcfce7;
    color: #15803d;
}

.badge-draft {
    background: #f1f5f9;
    color: #475569;
}

/* Form Styles */
.form-layout {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 28px;
}

.form-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--admin-primary);
}

textarea.form-control {
    min-height: 120px;
    line-height: 1.6;
}

.editor-textarea {
    min-height: 480px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* Editor Toolbar */
.editor-toolbar {
    background: #f1f5f9;
    border: 1px solid var(--admin-border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-btn {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.toolbar-btn:hover {
    background: #e2e8f0;
}

.toolbar-btn-shopee {
    background: var(--admin-accent);
    color: #fff;
    border-color: var(--admin-accent);
}

.toolbar-btn-shopee:hover {
    background: #d73211;
}

/* Modal Popup */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}

.modal-content {
    background: #fff;
    border-radius: 10px;
    max-width: 620px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--admin-border);
    padding-bottom: 12px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--admin-muted);
}

/* Login Card */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: #fff;
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    padding: 36px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.login-sub {
    font-size: 13px;
    color: var(--admin-muted);
    margin-bottom: 24px;
    text-align: center;
}

.alert-danger {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 13px;
}

/* Product Photo Manager & Media Picker */
.product-photo-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f8fafc;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 14px 16px;
    transition: all 0.2s;
}

.product-photo-card:hover {
    background: #fff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.product-photo-thumb {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    object-fit: cover;
    background: #e2e8f0;
    border: 1px solid var(--admin-border);
    flex-shrink: 0;
}

.product-photo-info {
    flex: 1;
    min-width: 0;
}

.product-photo-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--admin-text);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-photo-meta {
    font-size: 12px;
    color: var(--admin-muted);
    margin-bottom: 8px;
}

.product-photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Media Picker Modal */
.media-modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 16px;
}

.media-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.media-picker-item {
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #f1f5f9;
    aspect-ratio: 1;
    position: relative;
    transition: all 0.15s;
}

.media-picker-item:hover {
    border-color: var(--admin-accent);
    transform: scale(1.02);
}

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

.media-picker-item .item-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 10px;
    padding: 3px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

