/* ErtechReviewHub Dashboard Styles */

/* ===== Base ===== */
* { box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; }

/* ===== Dark Mode ===== */

/* ===== Sidebar ===== */
.sidebar {
    transition: width 0.3s ease;
}
.sidebar.collapsed {
    width: 4.5rem;
}
.sidebar.collapsed .sidebar-text {
    display: none;
}
.sidebar.collapsed + #mainContent {
    margin-left: 4.5rem;
}

.nav-item {
    position: relative;
    transition: all 0.15s ease;
}
.nav-item.active {
    background: #0f172a;
    color: #fff;
    border-right: 3px solid #3b82f6;
}
.nav-item:hover {
    background: #334155;
}

/* ===== Cards ===== */
.card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.card-clickable:hover {
    transform: translateY(-1px);
    cursor: pointer;
}

/* ===== Counter Cards ===== */
.counter-card {
    padding: 1.25rem;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid transparent;
}
.counter-card.blue { border-left-color: #3b82f6; }
.counter-card.green { border-left-color: #10b981; }
.counter-card.purple { border-left-color: #8b5cf6; }
.counter-card.orange { border-left-color: #f59e0b; }
.counter-card.red { border-left-color: #ef4444; }
.counter-card.indigo { border-left-color: #6366f1; }
.counter-card.cyan { border-left-color: #06b6d4; }
.counter-card.teal { border-left-color: #14b8a6; }

/* ===== Star Rating ===== */
.stars { display: inline-flex; gap: 1px; }
.star { color: #d1d5db; font-size: 1rem; line-height: 1; }
.star.filled { color: #f59e0b; }
.star.half {
    position: relative;
    color: #d1d5db;
}
.star.half::before {
    content: '\2605';
    position: absolute;
    left: 0;
    width: 50%;
    overflow: hidden;
    color: #f59e0b;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

/* Sentiment badges */
.badge-positive { background: #d1fae5; color: #065f46; }
.badge-neutral { background: #dbeafe; color: #1e40af; }
.badge-negative { background: #fef3c7; color: #92400e; }
.badge-critical { background: #fee2e2; color: #991b1b; }
.badge-mixed { background: #e0e7ff; color: #3730a3; }

/* Category badges */
.badge-bug { background: #fee2e2; color: #991b1b; }
.badge-feature_request { background: #ede9fe; color: #5b21b6; }
.badge-payment { background: #fef3c7; color: #92400e; }
.badge-account { background: #ffedd5; color: #9a3412; }
.badge-performance { background: #e0e7ff; color: #3730a3; }
.badge-ui_ux { background: #cffafe; color: #155e75; }
.badge-positive_feedback { background: #d1fae5; color: #065f46; }
.badge-toxic { background: #fce7f3; color: #9d174d; }
.badge-spam { background: #f3f4f6; color: #374151; }
.badge-general { background: #f3f4f6; color: #374151; }
.badge-content { background: #fae8ff; color: #86198f; }
.badge-login { background: #fef9c3; color: #854d0e; }

/* Status badges */
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-replied { background: #d1fae5; color: #065f46; }
.badge-auto_replied { background: #ede9fe; color: #5b21b6; }
.badge-skipped { background: #f3f4f6; color: #374151; }
.badge-failed { background: #fee2e2; color: #991b1b; }

/* Platform badges */
.badge-android { background: #d1fae5; color: #065f46; }
.badge-ios { background: #dbeafe; color: #1e40af; }

/* ===== Loading ===== */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.loading-spinner.sm { width: 1rem; height: 1rem; border-width: 2px; }
.loading-spinner.lg { width: 3rem; height: 3rem; border-width: 4px; }

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

.skeleton {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.375rem;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Toast ===== */
.toast {
    padding: 0.875rem 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 450px;
    animation: toast-in 0.3s ease;
    font-size: 0.875rem;
}
.toast.toast-out { animation: toast-out 0.3s ease forwards; }
.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 toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ===== Confidence Bar ===== */
.confidence-bar {
    height: 0.5rem;
    border-radius: 9999px;
    background: #e5e7eb;
    overflow: hidden;
}
.confidence-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease;
}

/* ===== Table ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    background: #f9fafb;
}
.data-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.data-table tbody tr {
    transition: background 0.1s ease;
}
.data-table tbody tr:hover {
    background: #f8fafc;
}
.data-table tbody tr.clickable { cursor: pointer; }

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}
.filter-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.filter-bar .filter-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
}
.filter-bar input,
.filter-bar select {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
}
.filter-bar input:focus,
.filter-bar select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}
.pagination button {
    min-width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}
.pagination button:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #d1d5db;
}
.pagination button.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}
.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Star Filter ===== */
.star-filter {
    display: inline-flex;
    gap: 0.25rem;
}
.star-filter-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.15s;
}
.star-filter-btn:hover { border-color: #f59e0b; }
.star-filter-btn.active {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

/* ===== Tabs ===== */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
}
.tab-item {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}
.tab-item:hover { color: #374151; }
.tab-item.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

/* ===== Toggle Switch ===== */
.toggle {
    position: relative;
    width: 2.75rem;
    height: 1.5rem;
    background: #d1d5db;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle.active { background: #3b82f6; }
.toggle::after {
    content: '';
    position: absolute;
    top: 0.125rem;
    left: 0.125rem;
    width: 1.25rem;
    height: 1.25rem;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.toggle.active::after { transform: translateX(1.25rem); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    #mainContent {
        margin-left: 0 !important;
    }
}

/* ===== Misc ===== */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fade-in {
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Chart containers */
.chart-container {
    position: relative;
    width: 100%;
}

/* Review text in table */
.review-text-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Alternative reply cards */
.alt-reply-card {
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}
.alt-reply-card:hover { border-color: #93c5fd; }
.alt-reply-card.selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

/* Slider */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ========================================
   DARK MODE OVERRIDES
   ======================================== */

/* Cards */
.dark .card,
.dark .counter-card {
    background: #1e293b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.dark .card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Nav items */
.dark .nav-item.active {
    background: #0f172a;
}
.dark .nav-item:hover {
    background: #334155;
}

/* Tables */
.dark .data-table th {
    color: #94a3b8;
    border-bottom-color: #334155;
    background: #0f172a;
}
.dark .data-table td {
    border-bottom-color: #1e293b;
    color: #e2e8f0;
}
.dark .data-table tbody tr:hover {
    background: #334155;
}

/* Filter bar */
.dark .filter-bar input,
.dark .filter-bar select {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}
.dark .filter-bar .filter-group label {
    color: #94a3b8;
}

/* Pagination */
.dark .pagination button {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}
.dark .pagination button:hover:not(:disabled) {
    background: #334155;
    border-color: #64748b;
}
.dark .pagination button.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* Tabs */
.dark .tab-bar {
    border-bottom-color: #334155;
}
.dark .tab-item {
    color: #94a3b8;
}
.dark .tab-item:hover {
    color: #e2e8f0;
}

/* Toggle switch */
.dark .toggle {
    background: #475569;
}

/* Star filter */
.dark .star-filter-btn {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}

/* Loading */
.dark .loading-spinner {
    border-color: #334155;
    border-top-color: #3b82f6;
}
.dark .skeleton {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    background-size: 200% 100%;
}

/* Confidence bar */
.dark .confidence-bar {
    background: #334155;
}

/* Alt reply card */
.dark .alt-reply-card {
    border-color: #475569;
    color: #e2e8f0;
}
.dark .alt-reply-card:hover {
    border-color: #60a5fa;
}
.dark .alt-reply-card.selected {
    border-color: #3b82f6;
    background: #1e3a5f;
}

/* Slider */
.dark input[type="range"] {
    background: #334155;
}

/* General dark overrides for Tailwind inline classes that use bg-white, bg-gray-50, etc. */
.dark .bg-white { background-color: #1e293b !important; }
.dark .bg-gray-50 { background-color: #0f172a !important; }
.dark .bg-gray-100 { background-color: #1e293b !important; }
.dark .border-gray-200 { border-color: #334155 !important; }
.dark .border-gray-300 { border-color: #475569 !important; }
.dark .text-gray-900 { color: #f1f5f9 !important; }
.dark .text-gray-800 { color: #e2e8f0 !important; }
.dark .text-gray-700 { color: #cbd5e1 !important; }
.dark .text-gray-600 { color: #94a3b8 !important; }
.dark .text-gray-500 { color: #94a3b8 !important; }
.dark .text-gray-400 { color: #64748b !important; }
.dark .hover\:bg-gray-50:hover { background-color: #334155 !important; }
.dark .hover\:bg-gray-100:hover { background-color: #334155 !important; }
.dark .hover\:text-gray-700:hover { color: #e2e8f0 !important; }
.dark .hover\:text-gray-900:hover { color: #f1f5f9 !important; }

/* Selected app cards (blue border cards) */
.dark .border-blue-500 { border-color: #3b82f6 !important; }
.dark .bg-blue-50 { background-color: #1e3a5f !important; }
.dark .bg-green-50 { background-color: #0f2a1e !important; }
.dark .bg-amber-50 { background-color: #2a1f0f !important; }
.dark .bg-gray-50 { background-color: #0f172a !important; }
.dark .bg-red-50 { background-color: #2a0f0f !important; }
.dark .bg-purple-50 { background-color: #1f0f2a !important; }
.dark .bg-yellow-50 { background-color: #2a2a0f !important; }
.dark .bg-indigo-50 { background-color: #0f0f2a !important; }

/* Colored borders in dark */
.dark .border-green-200, .dark .border-green-300 { border-color: #166534 !important; }
.dark .border-amber-200, .dark .border-amber-300 { border-color: #92400e !important; }
.dark .border-blue-200, .dark .border-blue-300 { border-color: #1e40af !important; }
.dark .border-red-200 { border-color: #991b1b !important; }
.dark .border-yellow-200 { border-color: #854d0e !important; }

/* Disabled buttons in dark */
.dark .bg-gray-300 { background-color: #334155 !important; }
.dark .text-gray-500 { color: #94a3b8 !important; }
.dark .cursor-not-allowed { color: #64748b !important; }

/* Table borders */
.dark .divide-gray-100 > * + * { border-color: #334155 !important; }
.dark .border-gray-100 { border-color: #1e293b !important; }
.dark .border-t { border-color: #334155; }

/* Inputs & selects in dark */
.dark input[type="text"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="number"],
.dark input[type="date"],
.dark input[type="month"],
.dark input[type="search"],
.dark input[type="url"],
.dark textarea,
.dark select {
    background-color: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}
.dark input::placeholder,
.dark textarea::placeholder {
    color: #64748b;
}

/* Modal overlay */
.dark #confirmDialog > div,
.dark .modal-content {
    background: #1e293b;
    color: #e2e8f0;
}

/* Scrollbar */
.dark ::-webkit-scrollbar { width: 8px; height: 8px; }
.dark ::-webkit-scrollbar-track { background: #0f172a; }
.dark ::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb:hover { background: #64748b; }
