﻿.ts-wrapper {
    margin-bottom: 0.5rem;
}

.ts-control {
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s;
}

html.dark .ts-control,
html.dark .ts-wrapper.single .ts-control {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
    color: #ffffff !important;
}

html.dark .ts-wrapper .ts-control>input {
    color: #ffffff !important;
}

html.dark .ts-wrapper .ts-control .item {
    color: #ffffff !important;
}

html.dark .ts-dropdown {
    background-color: #1f2937 !important;
    border-color: #4b5563 !important;
    color: #ffffff !important;
}

html.dark .ts-dropdown .option {
    background-color: #1f2937 !important;
    color: #e5e7eb !important;
}

html.dark .ts-dropdown .option.active,
html.dark .ts-dropdown .active {
    background-color: #374151 !important;
    color: #ffffff !important;
}

.ts-dropdown {
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

html.dark .spinner {
    border-color: #374151;
    border-top-color: #60a5fa;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}



.required-field label::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #d1d5db;
    margin-right: 6px;
    vertical-align: middle;
    transition: background-color 0.3s ease, transform 0.3s ease;
    transform: scale(1);
}

html.dark .required-field label::before {
    background-color: #4b5563;
}

@keyframes dotPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.5);
    }

    100% {
        transform: scale(1);
    }
}

.required-field.required-filled label::before {
    background-color: #16a34a !important;
    animation: dotPop 0.35s ease-out;
}

.photo-preview {

    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.photo-preview-item {
    position: relative;
    width: 100%;
    height: 100px;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.photo-preview-item.is-main {
    box-shadow: 0 0 0 3px #16a34a;
    border-radius: 0.5rem;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

html.dark .photo-preview img {
    border-color: #4b5563;
}

.photo-preview-item.is-main img {
    border-color: #16a34a;
}

.photo-main-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: #16a34a;
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 0 0 0.375rem 0;
    z-index: 10;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    pointer-events: none;
}

.photo-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.2s;
    z-index: 10;
}

.photo-delete-btn:hover {
    background: rgba(220, 38, 38, 1);
}

.photo-main-btn {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(255, 255, 255, 0.85);
    color: #9ca3af;
    border: none;
    border-radius: 0.375rem;
    padding: 2px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
    z-index: 10;
    font-size: 0.8125rem;
    font-weight: 600;
}

.photo-main-btn:hover {
    background: #16a34a;
    color: white;
}

html.dark .photo-main-btn {
    background: rgba(31, 41, 55, 0.85);
    color: #9ca3af;
}

html.dark .photo-main-btn:hover {
    background: #16a34a;
    color: white;
}

.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#loginScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f3f4f6;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease-in-out;
}

html.dark #loginScreen {
    background-color: #111827;
}

/* TomSelect Dark Mode Fixes */
html.dark .ts-wrapper .ts-control {
    background-color: #374151;
    border-color: #4b5563;
    color: white;
}

html.dark .ts-wrapper .ts-dropdown {
    background-color: #1f2937;
    border-color: #4b5563;
    color: white;
}

html.dark .ts-wrapper .ts-control input {
    color: white;
}

html.dark .ts-wrapper .ts-dropdown .option {
    color: #e5e7eb;
}

html.dark .ts-wrapper .ts-dropdown .option.active,
html.dark .ts-wrapper .ts-dropdown .active {
    background-color: #374151;
    color: white;
}

.hidden-screen {
    opacity: 0;
    pointer-events: none;
}

/* History Styles */
#historyModal {
    z-index: 60;
}

.history-item {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 0;
}

html.dark .history-item {
    border-color: #374151;
}

.history-status-success {
    color: #16a34a;
}

.history-status-error {
    color: #dc2626;
}

.history-status-pending {
    color: #ca8a04;
}

/* Autofill Fix */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #111827 !important;
    transition: background-color 5000s ease-in-out 0s;
}

html.dark input:-webkit-autofill,
html.dark input:-webkit-autofill:hover,
html.dark input:-webkit-autofill:focus,
html.dark input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #374151 inset !important;
    -webkit-text-fill-color: white !important;
}

.ai-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ai-status-badge.idle {
    background: #e5e7eb;
    color: #374151;
    border-color: #d1d5db;
}

.ai-status-badge.processing {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.ai-status-badge.done {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.ai-status-badge.partial {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.ai-status-badge.error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

html.dark .ai-status-badge.idle {
    background: #374151;
    color: #e5e7eb;
    border-color: #4b5563;
}

html.dark .ai-status-badge.processing {
    background: rgba(30, 64, 175, 0.25);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.5);
}

html.dark .ai-status-badge.done {
    background: rgba(22, 101, 52, 0.3);
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.5);
}

html.dark .ai-status-badge.partial {
    background: rgba(146, 64, 14, 0.35);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.55);
}

html.dark .ai-status-badge.error {
    background: rgba(127, 29, 29, 0.35);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.5);
}

.ai-processing {
    position: relative;
}

.ai-skeleton {
    animation: aiPulse 1.1s ease-in-out infinite;
}

.ai-processing .ai-skeleton {
    border-color: #bfdbfe !important;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.1);
}

html.dark .ai-processing .ai-skeleton {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.25);
}

@keyframes aiPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.65;
    }
}

.ai-filled-flash {
    animation: aiFilledFlash 1.2s ease;
}

@keyframes aiFilledFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
        background-color: rgba(187, 247, 208, 0.7);
    }

    100% {
        box-shadow: 0 0 0 14px rgba(34, 197, 94, 0);
        background-color: transparent;
    }
}

.ai-warning-panel {
    border: 1px solid #fcd34d;
    border-radius: 0.75rem;
    background: #fffbeb;
    overflow: hidden;
}

.ai-warning-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: none;
    background: transparent;
    color: #92400e;
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
}

.ai-warning-toggle-label {
    min-width: 0;
}

.ai-warning-toggle-action {
    white-space: nowrap;
    opacity: 0.85;
}

.ai-warning-list {
    padding: 0 0.5rem 0.5rem;
    display: grid;
    gap: 0.375rem;
}

.ai-warning-item {
    border: 1px solid #fbbf24;
    background: rgba(255, 251, 235, 0.9);
    color: #92400e;
    border-radius: 0.5rem;
    padding: 0.4rem 0.55rem;
    font-size: 0.75rem;
    line-height: 1.15rem;
}

.ai-warning-more {
    margin: 0 0.5rem 0.5rem;
    border: 1px solid #fbbf24;
    background: #fff7d6;
    color: #92400e;
    border-radius: 0.5rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

html.dark .ai-warning-panel {
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(146, 64, 14, 0.15);
}

html.dark .ai-warning-toggle {
    color: #fcd34d;
}

html.dark .ai-warning-item {
    border-color: rgba(251, 191, 36, 0.55);
    background: rgba(146, 64, 14, 0.25);
    color: #fcd34d;
}

html.dark .ai-warning-more {
    border-color: rgba(251, 191, 36, 0.55);
    background: rgba(146, 64, 14, 0.35);
    color: #fcd34d;
}