/* Modern UI Color Scheme for TQTag System - Inspired by Monday.com */

:root {
    /* Monday.com Inspired Colors with New Primary Purple */
    --bs-blue: #1a9df5;
    --bs-indigo: #6610f2;
    --bs-purple: #6638b6;
    --bs-pink: #ff5ac4;
    --bs-red: #e2445c;
    --bs-orange: #fdab3d;
    --bs-yellow: #ffcb00;
    --bs-green: #00c875;
    --bs-teal: #00a9ff;
    --bs-cyan: #579bfc;
    
    /* Gray Shades */
    --bs-gray: #8b9199;
    --bs-gray-dark: #323338;
    --bs-gray-100: #f5f6f8;
    --bs-gray-200: #ecedf1;
    --bs-gray-300: #dfe1e6;
    --bs-gray-400: #c5c7d0;
    --bs-gray-500: #9398a4;
    --bs-gray-600: #676879;
    --bs-gray-700: #515365;
    --bs-gray-800: #323338;
    --bs-gray-900: #1f1f1f;
    
    /* Theme Colors */
    --bs-primary: #6638b6;
    --bs-secondary: #676879;
    --bs-success: #00c875;
    --bs-info: #00a9ff;
    --bs-warning: #fdab3d;
    --bs-danger: #e2445c;
    --bs-light: #f5f6f8;
    --bs-dark: #323338;
    
    /* RGB Values */
    --bs-primary-rgb: 102, 56, 182;
    --bs-secondary-rgb: 103, 104, 121;
    --bs-success-rgb: 0, 200, 117;
    --bs-info-rgb: 0, 169, 255;
    --bs-warning-rgb: 253, 171, 61;
    --bs-danger-rgb: 226, 68, 92;
    --bs-light-rgb: 245, 246, 248;
    --bs-dark-rgb: 50, 51, 56;
    
    /* Body */
    --bs-body-color: #323338;
    --bs-body-bg: #f5f6f8;
    --bs-body-color-rgb: 50, 51, 56;
    --bs-body-bg-rgb: 245, 246, 248;
    
    /* Status Colors */
    --status-working: #fdab3d;
    --status-done: #00c875;
    --status-stuck: #e2445c;
    --status-planning: #00a9ff;
}

/* Hard-coded color overrides */
[style*="#4FC9DA"] { color: #6638b6 !important; }
[style*="#1a9df5"] { color: #6638b6 !important; }
[style*="background-color:#4FC9DA"] { background-color: #6638b6 !important; }
[style*="background-color:#1a9df5"] { background-color: #6638b6 !important; }
[style*="border-color:#4FC9DA"] { border-color: #6638b6 !important; }
[style*="border-color:#1a9df5"] { border-color: #6638b6 !important; }

.text-primary, .text-info { color: #6638b6 !important; }
.bg-primary, .bg-info { background-color: #6638b6 !important; }
.border-primary, .border-info { border-color: #6638b6 !important; }

a[href]:hover { color: #5a2fa0; }

/* SVG and icon overrides */
svg [fill="#4FC9DA"], svg [fill="#1a9df5"] { fill: #6638b6 !important; }
svg [stroke="#4FC9DA"], svg [stroke="#1a9df5"] { stroke: #6638b6 !important; }

/* Update menu hover and active states */
.menu-item .menu-link:hover:not(.disabled):not(.active) .menu-title, 
.aside-menu .menu .menu-item.hover>.menu-link:not(.disabled):not(.active) .menu-title,
.aside-menu .menu .menu-item .menu-link:hover:not(.disabled):not(.active) .menu-icon i, 
.aside-menu .menu .menu-item.hover>.menu-link:not(.disabled):not(.active) .menu-icon i {
    color: #6638b6 !important;
}

.menu-bullet .bullet, .side-menu .menu-bullet .bullet {
    background-color: #6638b6 !important;
}

.svg-icon svg [fill]:not(.permanent):not(g) {
    fill: #6638b6 !important;
}

/* Monday.com Inspired UI Elements */

/* Buttons */
.btn {
    font-weight: 500;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--bs-primary);
    color: white;
}

.btn-primary:hover {
    background-color: #5a2fa0;
    box-shadow: 0 4px 8px rgba(102, 56, 182, 0.25);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bs-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a5b69;
    box-shadow: 0 4px 8px rgba(103, 104, 121, 0.25);
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--bs-success);
    color: white;
}

.btn-success:hover {
    background-color: #00a95f;
    box-shadow: 0 4px 8px rgba(0, 200, 117, 0.25);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--bs-danger);
    color: white;
}

.btn-danger:hover {
    background-color: #d2304a;
    box-shadow: 0 4px 8px rgba(226, 68, 92, 0.25);
    transform: translateY(-1px);
}

/* Ghost Buttons - Monday.com Style */
.btn-outline-primary {
    background-color: transparent;
    color: var(--bs-primary);
    border: 1px solid var(--bs-primary);
}

.btn-outline-primary:hover {
    background-color: rgba(102, 56, 182, 0.1);
    color: #5a2fa0;
}

/* Links */
a {
    color: var(--bs-primary);
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    color: #5a2fa0;
    text-decoration: none;
}

/* Cards - Monday.com Style Panels */
.card {
    border-radius: 8px;
    border: none;
    box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(138, 145, 158, 0.1);
    transition: box-shadow 0.2s;
    background-color: white;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid var(--bs-gray-200);
    padding: 16px 20px;
    font-weight: 600;
}

/* Form controls */
.form-control {
    border-radius: 4px;
    border: 1px solid var(--bs-gray-300);
    padding: 8px 12px;
    height: auto;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.2);
}

.form-control::placeholder {
    color: var(--bs-gray-500);
}

/* Custom Select */
.form-select {
    border-radius: 4px;
    border: 1px solid var(--bs-gray-300);
    padding: 8px 12px;
    height: auto;
}

.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.2);
}

/* Tables - Monday.com Style */
.table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table thead th {
    border-top: none;
    border-bottom: 1px solid var(--bs-gray-300);
    color: var(--bs-gray-600);
    font-weight: 600;
    font-size: 14px;
    padding: 14px 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--bs-gray-200);
    vertical-align: middle;
    font-size: 15px;
}

.table tbody tr:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.04);
}

/* Navigation Sidebar - Monday.com Style */
.aside-menu {
    background-color: #f5f3ff;
}

.aside-menu .menu .menu-item .menu-link {
    border-radius: 4px;
    margin: 4px 0;
    padding: 10px 16px;
    transition: all 0.2s;
}

.aside-menu .menu .menu-item .menu-link:hover:not(.disabled):not(.active),
.aside-menu .menu .menu-item.hover>.menu-link:not(.disabled):not(.active) {
    color: var(--bs-primary);
    background-color: rgba(var(--bs-primary-rgb), 0.12);
}

.aside-menu .menu .menu-item .menu-link.active {
    background-color: #6638b6;
    color: white;
    font-weight: 500;
}

/* Status Badges - Monday.com Style */
.badge {
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
}

.badge-working {
    background-color: var(--status-working);
    color: white;
}

.badge-done {
    background-color: var(--status-done);
    color: white;
}

.badge-stuck {
    background-color: var(--status-stuck);
    color: white;
}

.badge-planning {
    background-color: var(--status-planning);
    color: white;
}

/* Section sidebar tree (replaces jsTree) */
.tqtag-section-tree-root {
    max-height: 55vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.25rem 0;
}

/* Portaled from section_sidebar_tree.js after shown.bs.dropdown — above aside (#kt_aside z-index ~101) and main UI */
.tqtag-section-tree-dropdown-menu.dropdown-menu {
    z-index: 2000 !important;
}
.tqtag-section-tree-row {
    min-height: 2rem;
    transition: background-color 0.15s ease;
}
.tqtag-section-tree-row:hover {
    background-color: var(--bs-gray-200);
}
[data-bs-theme="dark"] .tqtag-section-tree-row:hover {
    background-color: rgba(255, 255, 255, 0.06);
}
.tqtag-section-tree-draghandle {
    cursor: grab;
    flex-shrink: 0;
    padding: 0 2px;
}
.tqtag-section-tree-draghandle:active {
    cursor: grabbing;
}
.tqtag-section-tree-node.sortable-ghost {
    opacity: 0.45;
}

/* Original styles preserved */
.jstree-wholerow.jstree-wholerow-hovered{
    opacity:0.2!important;
}

#addsection {
    width:20px;
    height:20px;
    z-index:9999;
}

.live_cat_nav .dropdown-menu.show {
    top:27px;
}

.toggle_properties[aria-expanded="true"]>.bi-caret-down-fill,
.toggle_properties[aria-expanded="false"]>.bi-caret-up-fill,
.toggle_values[aria-expanded="true"]>.bi-caret-down-fill,
.toggle_values[aria-expanded="false"]>.bi-caret-up-fill {
    display: none;
}

.toggle_properties[aria-loading="true"]>.bi-caret-down-fill,
.toggle_properties[aria-loading="true"]>.bi-caret-up-fill,
.toggle_properties[aria-loading="false"]>.spinner-border,
.toggle_values[aria-loading="false"]>.spinner-border{
    display: none;
}

.field_holder div.input-group:nth-last-child(2) a.repeater_down,
.field_holder div.input-group:nth-child(2) a.repeater_up {opacity: 0;}

@media (min-width:767px) {
    .swal2-container .swal2-html-container {
        max-height:55vh;
        overflow: auto
    }
}

/* Monday.com UI Improvements */
body {
    font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    font-size: 14px;
    line-height: 1.5;
}

.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
    color: var(--bs-dark);
    font-weight: 600;
    margin-bottom: 1rem;
}

h1, .h1 { font-size: 32px; }
h2, .h2 { font-size: 24px; }
h3, .h3 { font-size: 20px; }
h4, .h4 { font-size: 18px; }
h5, .h5 { font-size: 16px; }
h6, .h6 { font-size: 14px; }

/* Monday.com Header and Toolbar */
.header, .toolbar, .navbar {
    background-color: white;
    box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.1);
    height: 97px;
    display: flex;
    align-items: center;
}

/* Monday.com style for main content */
.content-wrapper {
    padding: 24px;
    background-color: var(--bs-body-bg);
}

/* Monday.com style dropdown menus */
.dropdown-menu {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 8px;
    padding: 8px 0;
    min-width: 180px;
}

.dropdown-item {
    padding: 8px 16px;
    font-size: 14px;
    color: var(--bs-gray-800);
}

.dropdown-item:hover, .dropdown-item:focus {
    background-color: rgba(var(--bs-primary-rgb), 0.08);
    color: var(--bs-primary);
}

.dropdown-item.active {
    background-color: rgba(var(--bs-primary-rgb), 0.12);
    color: var(--bs-primary);
    font-weight: 500;
}

/* Switch and toggle improvements - Monday.com style */
.form-check-input {
    width: 36px;
    height: 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--bs-gray-300);
    border: none;
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.2);
    border-color: var(--bs-primary);
}

/* Monday.com Search Box */
.search-box {
    position: relative;
}

.search-box .form-control {
    padding-left: 36px;
    height: 40px;
    background-color: var(--bs-gray-100);
    border: 1px solid transparent;
}

.search-box .form-control:focus {
    background-color: white;
    border-color: var(--bs-gray-300);
}

.search-box::before {
    content: "\F52A";
    font-family: "bootstrap-icons";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bs-gray-500);
}

/* Monday.com style tabs */
.nav-tabs {
    border-bottom: 1px solid var(--bs-gray-200);
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 16px;
    font-weight: 500;
    color: var(--bs-gray-600);
}

.nav-tabs .nav-link:hover, .nav-tabs .nav-link:focus {
    border-color: transparent transparent var(--bs-gray-300);
    color: var(--bs-gray-800);
}

.nav-tabs .nav-link.active {
    border-color: transparent transparent var(--bs-primary);
    color: var(--bs-primary);
    background-color: transparent;
}

/* Monday.com status colors for various elements */
.status-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-circle.working { background-color: var(--status-working); }
.status-circle.done { background-color: var(--status-done); }
.status-circle.stuck { background-color: var(--status-stuck); }
.status-circle.planning { background-color: var(--status-planning); }

/* Customer status styles */
.customer-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.475rem;
    font-weight: 500;
    font-size: 0.85rem;
}

.customer-status.active {
    background-color: rgba(0, 200, 117, 0.1);
    color: #00c875;
}

.customer-status.inactive {
    background-color: rgba(226, 68, 92, 0.1);
    color: #e2445c;
}

/* Customer action icons */
.customer-actions .action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 0.475rem;
    transition: all 0.2s ease;
    color: #5e6278;
}

.customer-actions .action-icon:hover {
    background-color: #f5f8fa;
    color: #6638b6;
}

.customer-actions .edit-icon:hover {
    color: #6638b6;
}

.customer-actions .lock-icon:hover {
    color: #f1bc00;
}

.customer-actions .cart-icon:hover {
    color: #50cd89;
}

.customer-actions .trash-icon:hover {
    color: #f1416c;
}

.customer-actions .restore-icon:hover {
    color: #00c875;
}

.customer-actions .phone-icon:hover {
    color: #7239ea;
}

/* Responsive improvements */
@media (max-width: 991.98px) {
    .content-wrapper {
        padding: 16px;
    }
    
    .header, .toolbar, .navbar {
        height: 56px;
    }
}