/* =========================
   reevio-system.css
   Styles systeme de l'application (layout, boutons, dark mode)
   ========================= */

/* Reset body margin/padding - force alignment */
html, body {
    margin: 0 !important;
    padding: 0 !important;
}

/* Force main-content to start at very top */
#main-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Ensure header is exactly 60px and aligned with sidebar */
#main-content > header {
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    margin: 0 !important;
}

:root {
    --sidebar-width: 260px;
    --header-height: 60px;
    --primary: #4F2D9F;
    --primary-hover: #3A1D7E;
    --primary-active: #2E1765;
    --primary-light: #6B44C4;
    --primary-subtle: #F3EEFF;
    --accent: #F5C518;
}

/* Reset margins for headings and paragraphs */
h1, h2, h3, h4, h5, h6, p {
    margin: 0;
}

/* Button styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    border: none;
}
.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}
.btn-light {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}
.btn-light:hover {
    background-color: #e5e7eb;
}
.btn-success {
    background-color: #10b981;
    color: white;
}
.btn-success:hover {
    background-color: #059669;
}
.btn-danger {
    background-color: #ef4444;
    color: white;
}
.btn-danger:hover {
    background-color: #dc2626;
}
.btn-warning {
    background-color: #f59e0b;
    color: white;
}
.btn-warning:hover {
    background-color: #d97706;
}
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}
.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}
.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}
.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}
.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}
.badge-info {
    background-color: #e0e7ff;
    color: #3730a3;
}
.badge-sm {
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
}

/* Text colors */
.text-primary {
    color: var(--primary) !important;
}

/* Sidebar active link state */
.sidebar-link.active {
    background-color: rgba(79, 45, 159, 0.1);
    color: var(--primary);
}
.sidebar-link.active i {
    color: var(--primary);
}

/* Sidebar backdrop (mobile) */
@media (max-width: 1023px) {
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 40;
    }
}

/* KPI Cards */
.kpi-card {
    transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Main content positioning for sidebar alignment */
@media (min-width: 1024px) {
    #main-content {
        margin-left: 260px;
        margin-top: 0;
        padding-top: 0;
    }
    #main-content > header {
        margin-top: 0;
    }
}

/* Form spacing fix */
label {
    display: block;
    margin-bottom: 0.5rem;
}
input, select, textarea {
    margin-bottom: 0;
}

/* Star rating display */
.star-rating {
    display: inline-flex;
    gap: 2px;
}
.star-rating .star {
    color: #D1D5DB;
    font-size: 1rem;
}
.star-rating .star.filled {
    color: #FBBF24;
}
.star-on { color: #FBBF24 !important; }
.star-off { color: #D1D5DB !important; }

/* Review card styles */
.review-card {
    transition: box-shadow 0.2s;
}
.review-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* AI response indicator */
.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #4F2D9F, #6B44C4);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

/* ========================= */
/* DARK MODE STYLES          */
/* ========================= */
.dark {
    --primary: #A98AED;
    --primary-hover: #8B6BDB;
    --primary-active: #6B44C4;
}

html.dark {
    background-color: #0D0A14 !important;
}
.dark body.bg-gray-50,
.dark body {
    background-color: #0D0A14 !important;
    color: #E6DCFF !important;
}

/* Header dark */
.dark header,
.dark .bg-white {
    background-color: #14101E !important;
    border-color: #2A2044 !important;
}

/* Sidebar dark */
.dark aside,
.dark .sidebar-dark {
    background-color: #14101E !important;
    border-color: #2A2044 !important;
}

/* Text colors dark */
.dark .text-gray-900 {
    color: #F3EEFF !important;
}
.dark .text-gray-700 {
    color: #CDBAFE !important;
}
.dark .text-gray-600 {
    color: #A98AED !important;
}
.dark .text-gray-500 {
    color: #8578A5 !important;
}
.dark .text-gray-400 {
    color: #9A8FB5 !important;
}

/* Borders dark */
.dark .border-gray-200,
.dark .border-gray-100 {
    border-color: #2A2044 !important;
}
.dark .divide-gray-100 > * + *,
.dark .divide-gray-50 > * + * {
    border-color: #2A2044 !important;
}

/* Hover states dark */
.dark .hover\:bg-gray-50:hover,
.dark .hover\:bg-gray-100:hover {
    background-color: #1A1128 !important;
}

/* Inputs dark */
.dark input,
.dark select,
.dark textarea {
    background-color: #1D1430 !important;
    border-color: #3A2D58 !important;
    color: #F3EEFF !important;
}
.dark input::placeholder {
    color: #8578A5 !important;
}

/* Buttons dark */
.dark .btn-light {
    background-color: #1A1128;
    color: #E6DCFF;
    border-color: #3A2D58;
}
.dark .btn-light:hover {
    background-color: #2A2044;
}

/* Tables dark */
.dark table thead {
    background-color: #14101E !important;
}
.dark table tbody tr:hover {
    background-color: #1D1430 !important;
}

/* Modal dark */
.dark .bg-black\/50 {
    background-color: rgba(13, 10, 20, 0.8) !important;
}

/* ===== Custom Checkbox (AI Responses) ===== */
.ai-check-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.ai-check-label input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.ai-check-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid #d1d5db;
    background: #fff;
    transition: all 0.15s ease;
}
.ai-check-box i {
    font-size: 12px;
    color: transparent;
    transition: color 0.15s ease;
}
.ai-check-label input:checked + .ai-check-box {
    background: #4F2D9F;
    border-color: #4F2D9F;
}
.ai-check-label input:checked + .ai-check-box i {
    color: #fff;
}
.ai-check-label:hover .ai-check-box {
    border-color: #A98AED;
    box-shadow: 0 0 0 3px rgba(79, 45, 159, 0.1);
}
.dark .ai-check-box {
    background: #1D1430;
    border-color: #3A2D58;
}
.dark .ai-check-label input:checked + .ai-check-box {
    background: #6B44C4;
    border-color: #6B44C4;
}
.dark .ai-check-label:hover .ai-check-box {
    border-color: #A98AED;
    box-shadow: 0 0 0 3px rgba(107, 68, 196, 0.15);
}

/* ===== Dark mode : inner backgrounds ===== */
/* Translucent backgrounds instead of opaque greys */
.dark .bg-gray-50 {
    background-color: rgba(255, 255, 255, 0.04) !important;
}
.dark .bg-gray-100 {
    background-color: rgba(255, 255, 255, 0.06) !important;
}
.dark .bg-blue-50,
.dark .bg-blue-50\/50 {
    background-color: rgba(99, 130, 255, 0.08) !important;
}
.dark .bg-green-50 {
    background-color: rgba(34, 197, 94, 0.08) !important;
}
.dark .bg-orange-50 {
    background-color: rgba(249, 115, 22, 0.08) !important;
}
.dark .bg-red-50 {
    background-color: rgba(239, 68, 68, 0.08) !important;
}
.dark .bg-amber-50 {
    background-color: rgba(245, 158, 11, 0.08) !important;
}
.dark .bg-violet-50 {
    background-color: rgba(139, 92, 246, 0.08) !important;
}
.dark .bg-green-100 {
    background-color: rgba(34, 197, 94, 0.12) !important;
}
.dark .bg-orange-100 {
    background-color: rgba(249, 115, 22, 0.12) !important;
}
.dark .bg-red-100 {
    background-color: rgba(239, 68, 68, 0.12) !important;
}
.dark .bg-amber-100 {
    background-color: rgba(245, 158, 11, 0.12) !important;
}
.dark .bg-blue-100 {
    background-color: rgba(99, 130, 255, 0.12) !important;
}

/* Disabled button in dark mode */
.dark .btn-success:disabled,
.dark .btn-success.opacity-50 {
    background-color: #1A1128 !important;
    border-color: #3A2D58 !important;
    color: #8578A5 !important;
}

/* Dark mode toggle switch */
.theme-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: #e5e7eb;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.3s;
}
.theme-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 9999px;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.dark .theme-switch {
    background-color: #4F2D9F;
}
.dark .theme-switch::after {
    transform: translateX(20px);
}

/* ===== Table scroll hint (mobile) ===== */
.table-scroll-wrapper {
    position: relative;
}
.table-scroll-wrapper .scroll-hint {
    display: none;
}
@media (max-width: 767px) {
    .table-scroll-wrapper .scroll-hint {
        display: block;
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 48px;
        pointer-events: none;
        z-index: 10;
        background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,0.85) 40%, #fff);
    }
    .table-scroll-wrapper .scroll-hint::after {
        content: "\203A";
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        color: #6b7280;
        font-size: 28px;
        font-weight: bold;
        animation: scrollPulse 1.5s ease-in-out infinite;
    }
    .table-scroll-wrapper.scrolled .scroll-hint {
        display: none;
    }
}
@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: translateY(-50%) translateX(0); }
    50% { opacity: 1; transform: translateY(-50%) translateX(5px); }
}

/* ===== Sidebar toggle function ===== */
/* This CSS supports the toggleSidebar() JS function */
#sidebar.sidebar-open {
    transform: translateX(0) !important;
}
