:root {

    --primary-color: #f1580c;
    --primary-hover: #d44d0a;
    --secondary-color: #0f172a;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;


    --status-green: #dcfce7;
    --status-green-border: #86efac;
    --status-yellow: #fef08a;
    --status-yellow-border: #fde047;
    --status-red: #fee2e2;
    --status-red-border: #fca5a5;


    --sidebar-width: 260px;
    --border-radius: 8px;


    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --box-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --app-bg-gradient: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

[data-theme="dark"] {
    --primary-color: #f1580c;
    --primary-hover: #ff7e3d;
    --secondary-color: #cbd5e1;
    --background-color: #0b0b0b;
    --surface-color: #141414;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #262626;

    --status-green: rgba(22, 101, 52, 0.4);
    --status-green-border: rgba(34, 197, 94, 0.5);
    --status-yellow: rgba(133, 77, 14, 0.4);
    --status-yellow-border: rgba(234, 179, 8, 0.5);
    --status-red: rgba(153, 27, 27, 0.4);
    --status-red-border: rgba(239, 68, 68, 0.5);

    --app-bg-gradient: linear-gradient(135deg, #020617 0%, #0f172a 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;

    text-shadow: none !important;
}

body {
    background: var(--app-bg-gradient);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}


::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
    border: 2px solid var(--background-color);
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}


* {
    scrollbar-width: thin;
    scrollbar-color: #334155 var(--background-color);
}


h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--secondary-color);
    font-weight: 600;
}


.view-container {
    height: 100vh;
    width: 100vw;
    display: flex;
}

.view-container.hidden {
    display: none;
}

#app-container {
    padding: 1.25rem;
    gap: 1.25rem;
    background: transparent;
}

#login-container {
    justify-content: center;
    align-items: center;
    background: url('../wp-content/uploads/2024/01/Hatterkep-Alap-scaled.jpg') center/cover no-repeat !important;
}

.login-box {
    background-color: var(--surface-color);
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 400px;
    text-align: center;
    transition: transform 0.3s ease;
}

.login-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-hover);
}

.logo-container {
    margin-bottom: 2rem;
    background-color: transparent;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: center;
    align-items: center;
}

.brand-logo {
    max-width: 180px;
    height: auto;
}

.login-box h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}


.input-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    color: var(--text-main);
    background-color: var(--surface-color);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(241, 88, 12, 0.1);
}


.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--background-color);
    border-color: var(--text-muted);
}

.btn-block {
    width: 100%;
}



.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface-color);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-sidebar-close {
    display: none;
}

[data-theme="dark"] .sidebar-header,
[data-theme="dark"] .logo-container {
    background-color: #141414;
    border-color: #141414;
}

.brand-logo-small {
    max-width: 140px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
}

.nav-item.active {
    background-color: rgba(241, 88, 12, 0.05);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background-color: var(--background-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.user-details {
    display: flex;
    flex-direction: column;
}

#current-user-name {
    font-weight: 600;
    font-size: 0.875rem;
}

#current-user-role {
    display: none !important;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.btn-logout {
    width: 100%;
    background-color: var(--status-red);
    color: #ef4444;
}

.btn-logout:hover {
    background-color: var(--status-red-border);
    color: #b91c1c;
}


.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.topbar {
    background-color: var(--surface-color);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-area {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.filter-bar {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    background-color: var(--surface-color);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 220px;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.filter-group input,
.filter-group select,
.form-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    outline: none;
    background-color: var(--surface-color);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-group input:focus,
.filter-group select:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}


.multi-select-container {
    position: relative;
    width: 100%;
}

.multi-select-trigger {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--surface-color);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    min-height: 45px;
}

.multi-select-container.active .multi-select-trigger {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(241, 88, 12, 0.1);
}

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 1100;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    padding: 0.5rem;
    animation: fadeInDown 0.2s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.multi-select-container.active .multi-select-dropdown {
    display: block;
}

.multi-select-option {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
}

.multi-select-option:hover {
    background-color: var(--background-color);
}

.multi-select-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-pill {
    background-color: var(--primary-color);
    color: white;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Excel Timeline Slicer / DÁTUM Box Styling */
.excel-timeline-slicer {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.35rem 0.65rem;
    margin-bottom: 0;
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    height: 48px;
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--box-shadow);
}

.granularity-btn.active {
    background: var(--primary-color) !important;
    color: white !important;
    font-weight: 700 !important;
}

.timeline-tile {
    flex: 0 0 58px;
    min-width: 58px;
    max-width: 58px;
    height: 40px;
    padding: 3px 2px;
    text-align: center;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--background-color);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.timeline-tile .tile-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.timeline-tile .tile-main {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.timeline-tile.selected {
    background: rgba(241, 88, 12, 0.15) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 1px var(--primary-color);
}

.timeline-tile.selected .tile-main {
    color: var(--primary-color) !important;
}

.timeline-tile.selected .tile-sub {
    color: var(--primary-color) !important;
    opacity: 0.8;
}

.timeline-tile:hover:not(.selected) {
    background: rgba(241, 88, 12, 0.05);
    border-color: rgba(241, 88, 12, 0.3);
}

/* Dual Range Slider Styling */
#timeline-range-min::-webkit-slider-thumb,
#timeline-range-max::-webkit-slider-thumb {
    pointer-events: auto;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: ew-resize;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s ease;
}

#timeline-range-min::-webkit-slider-thumb:hover,
#timeline-range-max::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#timeline-range-min::-moz-range-thumb,
#timeline-range-max::-moz-range-thumb {
    pointer-events: auto;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: ew-resize;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}


#dashboard-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

#table-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.table-container {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table th {
    background-color: var(--background-color);
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.875rem;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 0 var(--border-color);
}

.data-table tfoot th,
.data-table tfoot td {
    position: sticky;
    bottom: 0;
    background-color: var(--background-color);
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 -1px 0 var(--border-color);
    padding: 1rem 1.5rem;
    transform: translateY(8px);
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: var(--background-color);
}


.row-status-yellow {
    background-color: var(--status-yellow) !important;
    border-bottom-color: var(--status-yellow-border) !important;
}

.row-status-green {
    background-color: var(--status-green) !important;
    border-bottom-color: var(--status-green-border) !important;
}

.row-status-red {
    background-color: var(--status-red) !important;
    border-bottom-color: var(--status-red-border) !important;
}


.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--box-shadow-hover);
    transform: translateY(0);
    animation: modalIn 0.3s ease-out forwards;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.prompt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.prompt-option-btn {
    background: rgba(148, 163, 184, 0.05);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.prompt-option-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    border-color: var(--primary-color);
}

.prompt-option-btn:focus,
.prompt-option-btn:active {
    outline: none !important;
    box-shadow: none !important;
}

.prompt-option-btn i {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.prompt-unique-title {
    background: linear-gradient(90deg, var(--primary-color), #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
}

.btn-close-modal:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

#dynamic-form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}


#dynamic-form-fields .input-group:has(textarea),
#dynamic-form-fields .input-group:has(input[type="file"]),
#dynamic-form-fields .input-group:has(input[name="partner"]),
#dynamic-form-fields .input-group:has(input[name="sorszam"]) {
    grid-column: 1 / -1;
}

.modal-body p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

#notification-container {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    width: auto;
    max-width: 90vw;
}

.notification {
    pointer-events: auto;
    min-width: 320px;
    padding: 1rem 1.8rem;
    border-radius: 16px;
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-main);
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        0 20px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    border: 1px solid var(--border-color);
    animation: notifyIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    position: relative;
    overflow: hidden;
}

[data-theme='dark'] .notification {
    background: rgba(30, 41, 59, 0.85);
}

.notification::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
}

.notification.success::after {
    background: linear-gradient(90deg, #22c55e, #10b981);
}

.notification.error::after {
    background: linear-gradient(90deg, #ef4444, #f43f5e);
}

.notification span {
    font-weight: 500;
    font-size: 0.95rem;
}

@keyframes notifyIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes notifyOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
}


.login-box.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

.login-box.locked {
    position: relative;
    overflow: hidden;
}


.login-box.locked .logo-container,
.login-box.locked h2,
.login-box.locked form {
    filter: blur(8px) grayscale(100%);
    pointer-events: none;
    opacity: 0.3;
}

#lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(15, 23, 42, 0.85);

    z-index: 100;
    color: #fff;
    text-align: center;
    padding: 2rem;
    border-radius: inherit;
    backdrop-filter: blur(4px);
}

#lock-overlay i {
    font-size: 3.5rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

#lock-overlay h3 {
    margin-bottom: 0.75rem;
    color: #ef4444;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 1.25rem;
    font-weight: 800;
}


.ai-working-border {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    box-shadow: inset 0 0 0 0 rgba(59, 130, 246, 0);
    transition: box-shadow 0.3s ease;
}

body.ai-active .ai-working-border {
    box-shadow: inset 0 0 20px 4px rgba(59, 130, 246, 0.6);
    animation: bluePulse 2s infinite ease-in-out;
}

@keyframes bluePulse {
    0% {
        box-shadow: inset 0 0 10px 2px rgba(59, 130, 246, 0.4);
    }

    50% {
        box-shadow: inset 0 0 30px 8px rgba(59, 130, 246, 0.8);
    }

    100% {
        box-shadow: inset 0 0 10px 2px rgba(59, 130, 246, 0.4);
    }
}

.ai-highlight-pulse {
    position: relative;
    z-index: 2001;
    border-radius: var(--border-radius);
}

/* removed greenPulse animation */

#ai-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;

    z-index: 2000;
}

.ai-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ai-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 450px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

[data-theme="dark"] #ai-chat-window {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#ai-chat-window.hidden {
    display: none;
}

.ai-chat-header {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.ai-chat-header div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#ai-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.8;
}

#ai-close:hover {
    opacity: 1;
}

#ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.ai-message.bot {
    align-self: flex-start;
    background: var(--background-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 0;
}

.ai-message.user {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 0;
}

.ai-message.loading {
    display: flex;
    gap: 4px;
    font-style: italic;
    color: var(--text-muted);
}

.ai-chat-input {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

#ai-input {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    outline: none;
    font-size: 0.85rem;
    color: var(--text-main);
}

#ai-send {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#ai-send:hover {
    background: var(--primary-hover);
}

#ai-mic {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

#ai-mic:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

#ai-mic.recording {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    animation: micPulse 1s infinite;
}

@keyframes micPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.ai-message .speak-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s;
}

.ai-message .speak-btn:hover {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    #ai-widget {
        bottom: 1.5rem;
        right: 1.5rem;
    }

    #ai-chat-window {
        right: 0;
        bottom: 70px;
        width: 300px;
        height: 400px;
    }

    #btn-add-new {
        bottom: 6rem;
        right: 1.5rem;
    }
}



.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
}

#sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 900;
}

@media (max-width: 768px) {
    body {
        overflow: auto;

    }

    .view-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -var(--sidebar-width);
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .mobile-sidebar-close {
        display: block;
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
        margin-left: auto;
    }

    #sidebar-overlay.active {
        display: block !important;
    }

    .mobile-menu-btn {
        display: block;
    }

    .topbar {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .topbar-left {
        display: flex;
        align-items: center;
        width: 100%;
    }

    .topbar-actions {
        width: 100%;
        display: flex;
        gap: 10px;
    }

    .topbar-actions .btn {
        flex: 1;
    }

    .content-area {
        padding: 1rem;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group input,
    .filter-group select {
        width: 100%;
    }

    .table-container {
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table th,
    .data-table td,
    .data-table tr {
        display: block;
    }

    .data-table thead {
        display: none;

    }

    .data-table tr {
        background-color: var(--surface-color);
        margin-bottom: 1rem;
        border-radius: var(--border-radius);
        box-shadow: var(--box-shadow);
        border: 1px solid var(--border-color);
        padding: 0.5rem;
    }

    .data-table td {
        border-bottom: 1px solid var(--border-color);
        padding: 0.75rem 0.5rem;
        padding-left: 45% !important;
        position: relative;
        text-align: right;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }

    .data-table td:last-child {
        border-bottom: none;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 0.5rem;
    }

    .data-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0.5rem;
        width: 40%;
        padding-right: 10px;
        white-space: normal;
        text-align: left;
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        display: flex;
        align-items: center;
        height: 100%;
        top: 0;
    }


    #btn-add-new {
        position: fixed;
        bottom: 5.5rem;
        right: 1.5rem;
        width: 60px;
        height: 60px;
        border-radius: 50%;
        font-size: 1.5rem;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        z-index: 800;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #btn-add-new i {
        margin: 0;
    }

    #btn-add-new span {
        display: none;

    }

    .topbar-actions {
        display: none;

    }

    .topbar {
        padding: 0.75rem 1rem;
    }

    .login-box {
        padding: 2rem 1.5rem;
        margin: 1rem;
        max-width: 90%;
    }

    .modal-content {
        max-width: 100%;
        margin: 0;
        min-height: 100vh;
        border-radius: 0;
        padding: 1.5rem 1rem;
        overflow-y: auto;
    }

    #modal-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.75rem;
    }

    #notification-container {
        left: 0;
        transform: none;
        width: 100%;
        top: 10px;
        padding: 0 15px;
    }

    .notification {
        min-width: unset;
        width: 100%;
        padding: 0.8rem 1.2rem;
    }
}

.dashboard-grid {
    display: grid;
    gap: 2rem;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-hover);
}

.stat-card.highlight {
    background: linear-gradient(135deg, var(--surface-color) 0%, rgba(241, 88, 12, 0.05) 100%);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-card i {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2.5rem;
    opacity: 0.1;
    color: var(--primary-color);
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    min-width: 0;
    min-height: 0;
}

.chart-card h3 {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}


.ai-ocr-banner {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
}

.ai-ocr-banner>i {
    color: #60a5fa;
    font-size: 1.75rem;
    text-shadow: 0 0 15px rgba(96, 165, 250, 0.5);
}

.ai-ocr-banner span {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
}

.btn-ai-small {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 8px;
    border: none;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-ai-small i {
    font-size: 1rem;
}

.btn-ai-small:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

[data-theme='dark'] .stat-card {
    background: var(--surface-color);
}

[data-theme='dark'] .ai-ocr-banner {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(30, 58, 138, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

.filter-btn-inactive {
    opacity: 0.5;
    pointer-events: none;
    transition: all 0.3s ease;
}

