/* ===================================
   口コミ分析ツール - Dashboard Style
   =================================== */

:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #14b8a6;
    --primary-bg: #f0fdfa;
    --accent: #f97316;
    --accent-light: #fed7aa;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --pink: #ec4899;
    --dark: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --sidebar-width: 72px;
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    margin: 0;
    padding: 0;
    color: var(--gray-800);
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    z-index: 100;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 24px;
    font-weight: 700;
    color: var(--primary-dark);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    width: 100%;
    padding: 0 8px;
}

.sidebar-item {
    width: 100%;
    padding: 12px 0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 18px;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: transparent;
}

.sidebar-item span {
    font-size: 9px;
    margin-top: 4px;
    font-weight: 500;
}

.sidebar-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
}

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

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-nav {
    display: flex;
    gap: 8px;
    margin-left: 16px;
}

.page-nav button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--gray-200);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    color: var(--gray-500);
}

.page-nav button:hover {
    background: var(--gray-50);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    color: var(--gray-400);
    font-size: 0.9rem;
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9rem;
    width: 150px;
}

/* Tabs - Horizontal */
.tabs-bar {
    display: flex;
    gap: 0;
    background: white;
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.tab-item {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-item:hover { color: var(--primary); }

.tab-item.active {
    background: var(--primary);
    color: white;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-700);
    margin: 0;
}

/* Stats Row */
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-box {
    flex: 1;
    min-width: 160px;
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.stat-icon.green { background: #dcfce7; color: var(--success); }
.stat-icon.orange { background: #ffedd5; color: var(--accent); }
.stat-icon.teal { background: var(--primary-bg); color: var(--primary); }
.stat-icon.pink { background: #fce7f3; color: var(--pink); }
.stat-icon.blue { background: #dbeafe; color: #3b82f6; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }

.stat-info .value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-800);
    line-height: 1.2;
}

.stat-info .label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* Grid Layout */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

@media (max-width: 1200px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Charts */
.chart-container {
    position: relative;
    width: 100%;
    height: 280px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Bar Chart (CSS) */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }

.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bar-label {
    width: 70px;
    font-size: 0.8rem;
    color: var(--gray-600);
    text-align: right;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    flex: 1;
    height: 18px;
    background: var(--gray-100);
    border-radius: 9px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 9px;
    transition: width 0.5s ease-out;
}

.bar-fill.gradient {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.bar-value {
    width: 45px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
}

/* Tables */
.table-wrapper { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    padding: 12px 14px;
    font-weight: 600;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.data-table tr:hover { background: var(--gray-50); }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-positive { background: #dcfce7; color: #166534; }
.badge-neutral { background: #fef3c7; color: #92400e; }
.badge-negative { background: #fee2e2; color: #991b1b; }
.badge-primary { background: var(--primary-bg); color: var(--primary); }

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--gray-100);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.tag:hover { background: var(--primary); color: white; }
.tag.active { background: var(--primary); color: white; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }

.btn-outline { background: white; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-bg); }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Form Elements */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-bottom: 6px;
}

input[type="text"], input[type="file"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: border-color 0.2s;
    background: white;
}

input[type="text"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Post Card (小红书) */
.post-card {
    background: linear-gradient(135deg, #fff7ed, #fff);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

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

.post-author { font-weight: 700; font-size: 1rem; color: var(--gray-800); }
.post-date { font-size: 0.8rem; color: var(--gray-400); }
.post-content { line-height: 1.7; color: var(--gray-700); margin-bottom: 12px; font-size: 0.95rem; }
.post-hashtags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.post-hashtag { color: var(--accent); font-size: 0.8rem; font-weight: 500; }
.post-stats { display: flex; gap: 20px; color: var(--gray-500); font-size: 0.85rem; }
.post-stat { display: flex; align-items: center; gap: 4px; }

/* Comment Item */
.comment-item {
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    margin-bottom: 10px;
}

.comment-item:hover { background: var(--gray-100); }
.comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.comment-author { font-weight: 600; color: var(--gray-700); font-size: 0.9rem; }
.comment-meta { display: flex; gap: 10px; align-items: center; font-size: 0.8rem; color: var(--gray-400); }
.comment-text { line-height: 1.6; color: var(--gray-600); font-size: 0.9rem; }

.comment-text .pos-word { background: #dcfce7; color: #166534; padding: 1px 4px; border-radius: 3px; }
.comment-text .neg-word { background: #fee2e2; color: #991b1b; padding: 1px 4px; border-radius: 3px; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.show { display: flex; }

.modal-content {
    background: white;
    border-radius: var(--radius);
    padding: 28px;
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 22px;
    color: var(--gray-400);
    cursor: pointer;
}

.modal-close:hover { color: var(--gray-700); }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.alert-info { background: var(--primary-bg); color: var(--primary-dark); }
.alert-error { background: #fee2e2; color: #991b1b; display: none; }

/* Loading */
.loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Utility */
.text-center { text-align: center; }
.hidden { display: none !important; }

/* Section */
.section { display: none; }
.section.active { display: block; }

/* Highlight Legend */
.highlight-legend {
    display: flex;
    gap: 16px;
    padding: 10px 14px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 0.8rem;
}

.hl-pos { color: var(--success); }
.hl-neg { color: var(--danger); }

/* Analysis tabs */
.analysis-tab { display: none; }
.analysis-tab.active { display: block; }
.pos-tab { display: none; }
.pos-tab.active { display: block; }
.load-section { display: none; }
.load-section.active { display: block; }
.platform-section { display: none; }
.platform-section.active { display: block; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--gray-400);
}

.empty-state .icon { font-size: 40px; margin-bottom: 12px; }

/* Help Button */
.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    border: none;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 8px;
    vertical-align: middle;
    transition: background 0.2s;
}
.help-btn:hover { background: var(--primary-bg); color: var(--primary); }

/* Button Row - prevent wrap */
.btn-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
}
.btn-row select { padding: 6px 8px; font-size: 0.85rem; }
.btn-row .btn { padding: 6px 12px; font-size: 0.85rem; }

/* Mobile Menu */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--gray-600);
}
.mobile-menu {
    position: fixed;
    top: 60px;
    right: 16px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 180px;
    overflow: hidden;
}
.mobile-menu.hidden { display: none; }
.mobile-menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
}
.mobile-menu-item:hover { background: var(--gray-50); }
.mobile-menu-item:last-child { border-bottom: none; }
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 999;
}
.menu-overlay.hidden { display: none; }

/* Desktop actions */
.desktop-actions { display: flex; gap: 8px; }

/* Mobile Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--gray-500);
    padding: 4px;
    transition: color 0.2s;
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item:hover { color: var(--primary-dark); }
.bottom-nav-icon { font-size: 20px; }
.bottom-nav-label { font-size: 11px; margin-top: 2px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 56px; padding: 12px 0; }
    .sidebar-logo { width: 32px; height: 32px; font-size: 14px; }
    .sidebar-item { padding: 10px 0; font-size: 16px; }
    .sidebar-item span { display: none; }
    .main-content { margin-left: 56px; padding: 16px; }
    .page-header { flex-direction: row; align-items: center; }
    .page-title { font-size: 1.1rem; flex: 1; }
    .stats-row { flex-direction: column; }
    .stat-box { min-width: 100%; }
    
    /* Mobile: hide desktop actions, show hamburger */
    .desktop-actions { display: none; }
    .hamburger-btn { display: block; }
    
    /* Card header responsive */
    .card-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .card-header .btn-row { width: 100%; justify-content: flex-start; overflow-x: auto; }
    
    /* Grid responsive */
    .grid-2 { grid-template-columns: 1fr; }
    
    /* Tabs bar scroll */
    .tabs-bar { overflow-x: auto; flex-wrap: nowrap; }
    .tab-item { white-space: nowrap; flex-shrink: 0; }
}

@media (max-width: 480px) {
    /* Hide sidebar, show bottom nav */
    .sidebar { display: none; }
    .bottom-nav { display: flex; }
    .main-content { margin-left: 0; padding: 12px; padding-bottom: 70px; }
    .page-title { font-size: 1rem; }
    .btn-row { flex-wrap: wrap; }
    .btn-row .btn { flex: 1; min-width: 80px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
