/* 
 * Custom Styles for Survey System
 * شرکت روان گداز پردیس
 */

/* تنظیمات پایه */
:root {
    --primary-color: #c62828;
    --primary-hover: #b71c1c;
    --primary-light: #ef5350;
    --secondary-color: #ffffff;
    --text-dark: #1f2937;
    --text-gray: #6b7280;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
}

/* اضافه کردن انیمیشن‌ها */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

/* استایل‌های دکمه‌های سفارشی */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(198, 40, 40, 0.3);
}

.btn-outline {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

/* استایل‌های کارت */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* استایل‌های فرم */
.form-input {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    transition: all 0.3s ease;
    width: 100%;
}

.form-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}

/* استایل‌های رادیو و چک‌باکس سفارشی */
.radio-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.radio-card:hover {
    border-color: var(--primary-light);
    background: #fef2f2;
}

.radio-card.selected {
    border-color: var(--primary-color);
    background: #fef2f2;
}

.radio-card.selected::before {
    content: '✓';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* استایل نمره‌دهی عددی */
.number-btn {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.number-btn:hover {
    border-color: var(--primary-color);
    background: #fef2f2;
}

.number-btn.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Sidebar استایل‌های */
.sidebar {
    background: linear-gradient(180deg, var(--primary-color), var(--primary-hover));
    min-height: 100vh;
}

.sidebar-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 4px 12px;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* استایل‌های جدول */
.table-hover tbody tr {
    transition: all 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: #fef2f2;
}

/* Wizard استایل‌های */
.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.step-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.3s ease;
}

.step-indicator.completed {
    background: var(--primary-color);
    color: white;
}

.step-indicator.current {
    background: var(--primary-color);
    color: white;
    animation: pulse 2s infinite;
}

.step-indicator.pending {
    background: var(--border-color);
    color: var(--text-gray);
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

.toast-success {
    background: #10b981;
}

.toast-error {
    background: var(--primary-color);
}

/* Importance Rating */
.importance-rating {
    display: flex;
    gap: 8px;
}

.importance-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.importance-btn:hover {
    border-color: var(--primary-color);
}

.importance-btn.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .number-btn {
        width: 40px;
        height: 40px;
    }
}

/* ============================================
 * DATA TABLE STYLES
 * ============================================ */

/* استایل پایه جدول */
.datatable-wrapper {
    --datatable-primary: #c62828;
    --datatable-hover: #fef2f2;
    --datatable-border: #e5e7eb;
}

/* انیمیشن fade in برای جدول */
@keyframes tableSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.datatable-wrapper {
    animation: tableSlideIn 0.3s ease-out;
}

/* استایل toolbar */
.datatable-toolbar {
    background: linear-gradient(to bottom, #ffffff, #f9fafb);
}

/* استایل input های جستجو */
.datatable-wrapper input[type='text'] {
    transition: all 0.2s ease;
}

.datatable-wrapper input[type='text']:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(198, 40, 40, 0.15);
}

/* استایل جدول دسکتاپ */
.datatable-wrapper table {
    border-collapse: separate;
    border-spacing: 0;
}

.datatable-wrapper thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    user-select: none;
}

.datatable-wrapper thead th[data-column] {
    transition: background-color 0.2s ease;
}

.datatable-wrapper thead th[data-column]:hover {
    background-color: #f3f4f6;
}

.datatable-wrapper thead th[data-column]:active {
    background-color: #e5e7eb;
}

.datatable-wrapper tbody tr {
    transition: all 0.15s ease;
}

.datatable-wrapper tbody tr:hover {
    background-color: var(--datatable-hover);
    transform: scale(1.001);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* استایل کارت‌های موبایل */
.datatable-wrapper div[data-row-index] {
    transition: all 0.2s ease;
}

.datatable-wrapper div[data-row-index]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* استایل صفحه‌بندی */
.pagination-btn {
    transition: all 0.2s ease;
    font-weight: 500;
}

.pagination-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pagination-btn:not(:disabled):active {
    transform: translateY(0);
}

/* استایل dropdown مدیریت ستون‌ها */
#column-manager-dropdown {
    animation: dropdownSlideIn 0.2s ease-out;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* استایل checkbox ها */
.column-toggle {
    cursor: pointer;
    transition: all 0.2s ease;
}

.column-toggle:checked {
    background-color: var(--datatable-primary);
    border-color: var(--datatable-primary);
}

/* استایل آمار فوتر */
.datatable-wrapper > div:last-child {
    background: linear-gradient(to top, #f9fafb, #ffffff);
}

/* استایل دکمه‌های اکشن */
.datatable-wrapper button[title] {
    transition: all 0.2s ease;
}

.datatable-wrapper button[title]:hover {
    transform: scale(1.1);
}

.datatable-wrapper button[title]:active {
    transform: scale(0.95);
}

/* استایل empty state */
.datatable-wrapper tbody td[colspan] {
    animation: fadeIn 0.3s ease-out;
}

/* اسکرول بار سفارشی برای جدول */
.datatable-wrapper .overflow-x-auto::-webkit-scrollbar {
    height: 8px;
}

.datatable-wrapper .overflow-x-auto::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.datatable-wrapper .overflow-x-auto::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.datatable-wrapper .overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .datatable-toolbar {
        padding: 1rem;
    }
    
    .datatable-toolbar > div {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    #column-search-container {
        grid-template-columns: 1fr 1fr;
    }
}

/* Loading state */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.datatable-loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Print styles */
@media print {
    .datatable-toolbar,
    .datatable-wrapper button,
    .pagination-btn,
    .datatable-wrapper > div:last-child {
        display: none !important;
    }
    
    .datatable-wrapper {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .datatable-wrapper tbody tr:hover {
        background-color: transparent;
    }
}

/* ============================================
 * CHART.JS STYLES
 * ============================================ */

/* تنظیمات پیش‌فرض فونت برای نمودارها */
canvas {
    font-family: Vazirmatn, sans-serif !important;
}
