/* Standardized Abstracted UI Components */

/* 1. Standard Input Fields */
.input-standard {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem; /* px-4 py-3 */
    border-radius: 0.75rem; /* rounded-xl */
    border-width: 1px;
    border-color: #d1d5db; /* border-gray-300 */
    background-color: #f9fafb; /* bg-gray-50 */
    font-size: 0.875rem; /* text-sm */
    line-height: 1.25rem;
    font-weight: 500;
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* shadow-sm */
}

.input-standard:focus {
    background-color: #ffffff;
    border-color: #a855f7; /* focus:border-purple-500 or fallback indigo */
    --tw-ring-color: #e9d5ff; /* focus:ring-purple-200 */
    --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}

select.input-standard {
    padding-right: 2.5rem;
}

.dark input[type="date"].input-standard::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
}

/* 2. Standard Responsive Card Wrapper */
.card-standard {
    background-color: #ffffff; /* bg-white */
    padding: 1.5rem; /* p-6 */
    border-radius: 1rem; /* rounded-2xl */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-md */
    border-width: 1px;
    border-color: #f3f4f6; /* border-gray-100 */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

@media (min-width: 640px) {
    .card-standard {
        padding: 2rem; /* sm:p-8 */
    }
}

/* 3. Paginated Grid/Table Wrapper */
.grid-standard {
    background-color: #ffffff; /* bg-white */
    padding: 1.5rem; /* p-6 */
    border-radius: 0.75rem; /* rounded-xl */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-md */
    border-width: 1px;
    border-color: #f3f4f6; /* border-gray-100 */
    margin-top: 2rem; /* mt-8 */
}

/* 4. Modal Standards */
.modal-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50; /* z-50 */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(17, 24, 39, 0.6); /* bg-gray-900 bg-opacity-60 */
    padding: 1rem; /* p-4 */
    backdrop-filter: blur(4px); /* backdrop-blur-sm */
    transition-property: opacity;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 300ms;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background-color: #ffffff; /* bg-white */
    padding: 1.5rem; /* p-6 for mobile */
    border-radius: 1rem; /* rounded-2xl */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); /* shadow-2xl */
    width: 100%;
    max-width: 100%; /* Better constraint for mobile to prevent horizontal overflow */
    min-width: min(100%, 28rem);
    position: relative;
    border-top-width: 4px;
}

@media (min-width: 640px) {
    .modal-box {
        padding: 2rem; /* p-8 for larger screens */
        max-width: fit-content; /* Allow fitting content on large screens */
    }
}

.modal-box-lg {
    min-width: min(100%, 32rem);
}

@keyframes modalPopIn {
    0% { opacity: 0; transform: scale(0.85) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes modalPopOut {
    0% { opacity: 1; transform: scale(1) translateY(0); }
    100% { opacity: 0; transform: scale(0.95) translateY(10px); }
}

.modal-wide {
    width: 100% !important;
    max-width: 56rem !important; /* 896px / 4xl */
}

/* Generic sizing for the modal close button */
.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #ffffff;
    padding: 0.5rem;
    border-radius: 9999px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition-property: transform, filter;
    transition-duration: 300ms;
    cursor: pointer;
    border: none;
}

.modal-close-btn:hover {
    transform: scale(1.05); /* hover:scale-105 */
}

.modal-close-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* 5. Dark Mode Auto-Mapping (Explicit class mapping for in-app theme toggler) */
.dark .card-standard { background-color: #1f2937; border-color: #374151; }
.dark .grid-standard { background-color: #1f2937; border-color: #374151; }
.dark .modal-box { background-color: #1f2937; color: #e5e7eb; border-color: #374151; }
.dark .input-standard { background-color: #374151; border-color: #4b5563; color: #f3f4f6; }
.dark .input-standard:focus { background-color: #1f2937; border-color: #a855f7; }

/* In-app specific widget dark mode manual bindings */
.dark .history-card { background-color: #1f2937; border-color: #374151; }
.dark .history-card:hover { border-color: #6366f1; }
.dark .history-day-circle { background-color: #374151; color: #818cf8; }
.dark .history-card h4 { color: #e5e7eb; }
.dark .history-card span { color: #9ca3af; }
.dark .history-divider { border-color: #374151; }
.dark .btn-preview { background-color: rgba(99, 102, 241, 0.1); color: #a5b4fc; }
.dark .btn-preview:hover { background-color: rgba(99, 102, 241, 0.2); }
.dark .btn-delete { background-color: rgba(244, 63, 94, 0.1); color: #fda4af; }
.dark .btn-delete:hover { background-color: rgba(244, 63, 94, 0.2); }

/* Transcript Modal Elements (Dark Mode) */
.dark #transcriptModalTitle { color: #a5b4fc !important; } /* text-indigo-300 */
.dark #transcriptModal .text-gray-500 { color: #9ca3af !important; }
.dark .chat-bubble.ai-bubble { background-color: #374151 !important; border-color: #4b5563 !important; color: #f3f4f6 !important; }
.dark .chat-bubble.user-bubble { background-color: #312e81 !important; border-color: #4338ca !important; color: #e0e7ff !important; }
.dark .chat-bubble .ai-icon { color: #818cf8 !important; }

/* Analytics Module Explicit Theme Decoupling */
.analytics-text-primary { color: #1f2937; }
.analytics-text-secondary { color: #6b7280; }
.analytics-text-accent { color: #4f46e5; }
.analytics-text-emerald { color: #059669; }
.analytics-bg-skeleton { background-color: #e5e7eb; }
.analytics-overlay { background-color: rgba(255, 255, 255, 0.6); }
.analytics-border { border-color: #e5e7eb; }
.analytics-accent-container { background-color: #eef2ff; border-color: #e0e7ff; }

.dark .analytics-text-primary { color: #f3f4f6; }
.dark .analytics-text-secondary { color: #9ca3af; }
.dark .analytics-text-accent { color: #818cf8; }
.dark .analytics-text-emerald { color: #34d399; }
.dark .analytics-bg-skeleton { background-color: #374151; }
.dark .analytics-overlay { background-color: rgba(17, 24, 39, 0.8); }
.dark .analytics-border { border-color: #374151; }
.dark .analytics-accent-container { background-color: rgba(31, 41, 55, 0.5); border-color: #374151; }
