@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #ffffff;
    color: #0f172a;
    overflow-x: hidden;
}

.wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

aside {
    width: var(--sidebar-width);
    border-right: 1px solid #e2e8f0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
    transform: translateZ(0);
}

.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    overflow: hidden;
    white-space: nowrap;
    border-bottom: 1px solid #e2e8f0;
}

aside.collapsed {
    width: var(--sidebar-collapsed-width);
}

aside.collapsed .sidebar-header {
    padding: 0;
    justify-content: center;
}

aside.collapsed .logo-text,
aside.collapsed .sidebar-label,
aside.collapsed .badge,
aside.collapsed .nav-section-title,
aside.collapsed .mobile-close-btn {
    display: none;
    opacity: 0;
}

aside.collapsed .sidebar-link {
    justify-content: center;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.nav-section-title {
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding: 0 1rem;
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: #94a3b8;
    text-transform: uppercase;
}

main {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: 100%;
}

.mobile-close-btn {
    display: none;
}

#sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 40;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.wrapper,
main,
body {
    direction: ltr !important;
}

@media (max-width: 1024px) {
    aside {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    aside.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    aside.collapsed {
        width: var(--sidebar-width);
    }

    .mobile-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    main {
        width: 100%;
        margin-left: 0 !important;
    }

    .wrapper {
        flex-direction: column;
    }
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: 4px;
    color: #475569;
}

.sidebar-link:hover {
    background-color: #f8fafc;
    color: #0f172a;
}

.sidebar-link.active {
    background-color: #f1f5f9;
    color: #0f172a;
    font-weight: 600;
}

html.dark body {
    background-color: #020617;
    color: #f8fafc;
}

html.dark aside {
    background-color: #020617;
    border-right: 1px solid #1e293b;
}

html.dark .sidebar-header {
    border-bottom: 1px solid #1e293b;
}

html.dark .nav-section-title {
    color: #475569;
}

html.dark .sidebar-link {
    color: #94a3b8;
}

html.dark .sidebar-link:hover {
    background-color: #1e293b;
    color: #ffffff;
}

html.dark .sidebar-link.active {
    background-color: #1e293b;
    color: #ffffff;
}

.bordered-card {
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
}

html.dark .bordered-card {
    border: 1px solid #1e293b;
    background-color: #020617;
}

.table-row-hover:hover {
    background-color: #f8fafc;
}

html.dark .table-row-hover:hover {
    background-color: #0f172a;
}

::-webkit-scrollbar {
    width: 4px;
    height: 2px;
}

::-webkit-scrollbar-track {
    background: transparent;
    margin-top: 6px;
    margin-bottom: 6px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

html.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

html.dark ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-out;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #ffffff;
    width: 100%;
    max-width: 32rem;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    transform: scale(0.95) translateY(10px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease-out;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

html.dark .modal-content {
    background-color: #0f172a;
    border-color: #334155;
}

.form-input {
    width: 100%;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    color: #0f172a;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    background-color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

.form-input::placeholder {
    color: #94a3b8;
}

html.dark .form-input {
    background-color: #0f172a;
    border-color: #1e293b;
    color: #f8fafc;
}

html.dark .form-input:focus {
    background-color: #1e293b;
    border-color: #f8fafc;
    box-shadow: 0 0 0 3px rgba(248, 250, 252, 0.1);
}

html.dark .form-input::placeholder {
    color: #475569;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.5rem;
}

html.dark .form-label {
    color: #cbd5e1;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%230f172a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

html.dark select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f8fafc' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

input[type="checkbox"].form-checkbox {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

input[type="checkbox"].form-checkbox:checked {
    background-color: #0f172a;
    border-color: #0f172a;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M12 5L6.5 10.5L4 8' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.75rem;
}

input[type="checkbox"].form-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

html.dark input[type="checkbox"].form-checkbox {
    background-color: #0f172a;
    border-color: #1e293b;
}

html.dark input[type="checkbox"].form-checkbox:checked {
    background-color: #f8fafc;
    border-color: #f8fafc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M12 5L6.5 10.5L4 8' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

html.dark input[type="checkbox"].form-checkbox:focus {
    box-shadow: 0 0 0 3px rgba(248, 250, 252, 0.1);
}

input[type="radio"].form-radio {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

input[type="radio"].form-radio:checked {
    background-color: #0f172a;
    border-color: #0f172a;
    box-shadow: inset 0 0 0 3px #ffffff;
}

input[type="radio"].form-radio:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

html.dark input[type="radio"].form-radio {
    background-color: #0f172a;
    border-color: #1e293b;
}

html.dark input[type="radio"].form-radio:checked {
    background-color: #f8fafc;
    border-color: #f8fafc;
    box-shadow: inset 0 0 0 3px #0f172a;
}

html.dark input[type="radio"].form-radio:focus {
    box-shadow: 0 0 0 3px rgba(248, 250, 252, 0.1);
}

.toast-enter {
    transform: translateX(100%);
    opacity: 0;
}

.toast-enter-active {
    transform: translateX(0);
    opacity: 1;
    transition: all 300ms ease-out;
}

.toast-exit {
    transform: translateX(0);
    opacity: 1;
}

.toast-exit-active {
    transform: translateX(100%);
    opacity: 0;
    transition: all 300ms ease-in;
}

@keyframes wave {
    0%, 100% { transform: scaleY(1); opacity: 0.5; }
    50% { transform: scaleY(2); opacity: 1; }
}

.animate-wave {
    animation: wave 1s ease-in-out infinite;
}

.mask-image-gradient {
    mask-image: linear-gradient(to bottom, transparent, black 5%, black 95%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 5%, black 95%, transparent);
}

.fade-in-up {
    animation: fadeInUp 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#chat-scroll-area::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}