/* Custom styles for Review Analytics App */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap');

* { box-sizing: border-box; }
body { font-family: 'Noto Sans JP', sans-serif; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.main-content { margin-left: 256px; flex: 1; background: #f8fafc; min-height: 100vh; }

/* Sidebar */
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 256px; background: #0f172a; display: flex; flex-direction: column; z-index: 10; overflow-y: auto; }
.sidebar-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid #1e293b; }
.sidebar-logo { display: flex; align-items: center; gap: 0.625rem; }
.sidebar-logo-icon { width: 2rem; height: 2rem; background: #6366f1; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-nav { flex: 1; padding: 0.75rem; }
.nav-section-label { padding: 1rem 1rem 0.25rem; font-size: 0.6875rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; color: #94a3b8; text-decoration: none; transition: background 0.15s, color 0.15s; margin-bottom: 1px; }
.nav-item:hover { background: #1e293b; color: #f1f5f9; }
.nav-item.active { background: #4f46e5; color: #fff; }
.nav-item svg { width: 1rem; height: 1rem; flex-shrink: 0; }
.sidebar-footer { padding: 0.75rem; border-top: 1px solid #1e293b; }

/* Page header */
.page-header { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 1rem 1.5rem; }
.page-title { font-size: 1.25rem; font-weight: 700; color: #0f172a; }
.page-subtitle { font-size: 0.875rem; color: #64748b; margin-top: 0.125rem; }

/* Cards */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 0.75rem; }
.card-body { padding: 1.25rem; }
.kpi-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1.25rem; }
.kpi-value { font-size: 1.875rem; font-weight: 700; color: #0f172a; line-height: 1; }
.kpi-label { font-size: 0.8125rem; color: #64748b; margin-top: 0.375rem; }
.kpi-sub { font-size: 0.8125rem; color: #94a3b8; margin-top: 0.25rem; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th { padding: 0.625rem 1rem; text-align: left; font-size: 0.75rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.025em; background: #f8fafc; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.table-container { overflow-x: auto; border-radius: 0.75rem; border: 1px solid #e2e8f0; background: #fff; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.6875rem; font-weight: 600; white-space: nowrap; }
.badge-amazon { background: #dbeafe; color: #1d4ed8; }
.badge-rakuten { background: #fee2e2; color: #b91c1c; }
.badge-shopify { background: #dcfce7; color: #15803d; }
.badge-unlinked { background: #fef3c7; color: #92400e; }
.badge-linked { background: #d1fae5; color: #065f46; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-error { background: #fee2e2; color: #b91c1c; }

/* Rating stars */
.rating { display: inline-flex; align-items: center; gap: 0.125rem; font-size: 0.875rem; }
.star-filled { color: #f59e0b; }
.star-empty { color: #d1d5db; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.5rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: background 0.15s; border: none; }
.btn-primary { background: #4f46e5; color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-orange { background: #f97316; color: #fff; }
.btn-orange:hover { background: #ea6c0a; }
.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }
.btn-xs { padding: 0.125rem 0.5rem; font-size: 0.75rem; }
.btn-link { background: none; color: #4f46e5; padding: 0; font-size: 0.875rem; }
.btn-link:hover { color: #4338ca; text-decoration: underline; }

/* Forms */
.form-input { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 0.5rem; font-size: 0.875rem; color: #0f172a; font-family: inherit; transition: border-color 0.15s; }
.form-input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 1.25rem; padding-right: 2rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; color: #374151; margin-bottom: 0.375rem; }
.form-hint { font-size: 0.75rem; color: #6b7280; margin-top: 0.25rem; }
.form-error { font-size: 0.75rem; color: #dc2626; margin-top: 0.25rem; }

/* Toast notifications */
.toast { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.875rem 1rem; border-radius: 0.5rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); min-width: 280px; max-width: 400px; animation: slideIn 0.2s ease; }
.toast-success { background: #065f46; color: #fff; }
.toast-error { background: #991b1b; color: #fff; }
.toast-warning { background: #92400e; color: #fff; }
.toast-info { background: #1e40af; color: #fff; }
@keyframes slideIn { from { opacity: 0; transform: translateX(1rem); } to { opacity: 1; transform: translateX(0); } }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-box { background: #fff; border-radius: 0.75rem; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 0.5rem; }

/* Drop zone */
.drop-zone { border: 2px dashed #cbd5e1; border-radius: 0.75rem; padding: 2.5rem; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.drop-zone:hover, .drop-zone.drag-over { border-color: #6366f1; background: #eef2ff; }
.drop-zone input[type="file"] { display: none; }

/* Alert */
.alert { padding: 0.875rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; display: flex; gap: 0.625rem; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #065f46; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 0.25rem; }
.page-btn { padding: 0.375rem 0.625rem; border-radius: 0.375rem; font-size: 0.875rem; cursor: pointer; border: 1px solid #e2e8f0; background: #fff; color: #374151; min-width: 2rem; text-align: center; }
.page-btn:hover { background: #f1f5f9; }
.page-btn.active { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.page-btn:disabled { opacity: 0.5; cursor: default; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid #e2e8f0; gap: 0; }
.tab-btn { padding: 0.75rem 1.25rem; font-size: 0.875rem; font-weight: 500; color: #64748b; border-bottom: 2px solid transparent; cursor: pointer; background: none; border-top: none; border-left: none; border-right: none; transition: color 0.15s; white-space: nowrap; }
.tab-btn:hover { color: #334155; }
.tab-btn.active { color: #4f46e5; border-bottom-color: #4f46e5; }

/* Loading */
.spinner { width: 1.25rem; height: 1.25rem; border: 2px solid #e2e8f0; border-top-color: #4f46e5; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 3rem; color: #64748b; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; padding: 3rem; color: #64748b; text-align: center; }
.empty-state svg { width: 3rem; height: 3rem; color: #cbd5e1; }

/* Text utilities */
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-break { word-break: break-all; }
.review-body-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Filters bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.filter-group { display: flex; align-items: center; gap: 0.375rem; }
