/**
 * AI Maintenance Extraction - Suggestions Drawer Styles
 */

/* Drawer Base */
#suggestions-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 600px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    border-left: 1px solid #e5e7eb;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 60000;
    overflow: hidden;
}

/* Dark mode drawer base */
html.dark #suggestions-drawer {
    background: #1f2937;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
    border-left: 1px solid #374151;
}

#suggestions-drawer.translate-x-0 {
    transform: translateX(0) !important;
}

#suggestions-drawer.translate-x-full {
    transform: translateX(100%) !important;
}

/* Drawer Inner */
#drawer-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Drawer Header */
#drawer-header-section {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    padding: 1.5rem;
    flex-shrink: 0;
}

#drawer-header-section > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#drawer-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

#drawer-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0.25rem 0 0 0;
}

#drawer-header-section button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    transition: opacity 0.2s;
    color: white;
}

#drawer-header-section button:hover {
    opacity: 0.8;
    color: #e5e7eb;
}

/* Progress State */
#drawer-progress-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

#drawer-progress-state > div {
    text-align: center;
}

#drawer-progress-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 1rem 0 0.5rem 0;
}

#drawer-progress-state p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0.5rem 0;
}

/* Dark mode progress state */
html.dark #drawer-progress-state h3 {
    color: #f9fafb;
}

html.dark #drawer-progress-state p {
    color: #9ca3af;
}

/* Loading State */
#drawer-loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

#drawer-loading-state > div {
    text-align: center;
}

#drawer-loading-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 1rem 0 0.5rem 0;
}

#drawer-loading-state p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0.5rem 0;
}

/* Dark mode loading state */
html.dark #drawer-loading-state h3 {
    color: #f9fafb;
}

html.dark #drawer-loading-state p {
    color: #9ca3af;
}

/* Spinner */
.spinner-border {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    vertical-align: text-bottom;
    border: 0.25rem solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* Results State */
#drawer-results-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Tabs Section */
#drawer-tabs-section {
    flex-shrink: 0;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 1.5rem;
}

#drawer-tabs-section nav {
    display: flex;
    gap: 1rem;
}

/* Tab Content */
#drawer-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    padding-bottom: 5rem; /* Space for bulk action bar */
}

/* Dark mode tab content */
html.dark #drawer-tab-content {
    background: #1f2937;
}

/* Lists */
#procedures-list,
#triggers-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

/* Empty States */
#procedures-empty,
#triggers-empty {
    text-align: center;
    padding: 2rem 0;
    color: #6b7280;
}

#procedures-empty i,
#triggers-empty i {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* Dark mode empty states */
html.dark #procedures-empty,
html.dark #triggers-empty {
    color: #9ca3af;
}

/* Tabs */
.drawer-tab {
    position: relative;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
}

.drawer-tab:hover {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.drawer-tab.drawer-tab-active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.drawer-tab i {
    margin-right: 0.5rem;
}

/* Dark mode tabs */
html.dark #drawer-tabs-section {
    border-bottom: 1px solid #374151;
}

html.dark .drawer-tab {
    color: #9ca3af;
}

html.dark .drawer-tab:hover {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

html.dark .drawer-tab.drawer-tab-active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

/* Tab Content - managed via JS inline styles */

/* Suggestion Cards */
.suggestion-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.suggestion-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #d1d5db;
}

/* Dark mode suggestion cards */
html.dark .suggestion-card {
    background: #1f2937;
    border: 1px solid #374151;
}

html.dark .suggestion-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: #4b5563;
}

.suggestion-card[data-status="approved"] {
    opacity: 0.6;
    background: #f0f9ff;
    pointer-events: none;
}

.suggestion-card[data-status="rejected"] {
    opacity: 0.4;
    background: #fef2f2;
    pointer-events: none;
}

/* Selected card state */
.suggestion-card.border-blue-500 {
    border-color: #3b82f6 !important;
    background: #eff6ff;
}

html.dark .suggestion-card.border-blue-500 {
    background: #1e3a8a;
    border-color: #60a5fa !important;
}

/* Dark mode card status states */
html.dark .suggestion-card[data-status="approved"] {
    background: #1e3a8a;
}

html.dark .suggestion-card[data-status="rejected"] {
    background: #7f1d1d;
}

/* Bulk Action Bar */
#bulk-action-bar {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 600px;
    background: white;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    z-index: 60001;
    animation: slideUp 0.3s ease-out;
    display: none;
}

@media (max-width: 640px) {
    #bulk-action-bar {
        width: 100vw;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Dark mode bulk action bar */
html.dark #bulk-action-bar {
    background: #1f2937;
    border-top-color: #374151;
}

/* Select All Container */
#select-all-container {
    border-left: 1px solid #e5e7eb;
    padding-left: 1rem;
    margin-left: 1rem;
}

html.dark #select-all-container {
    border-left-color: #374151;
}

html.dark #select-all-container label {
    color: #d1d5db;
}

/* Trigger Cards - Match Procedure Style */
.trigger-card {
    /* Inherits standard suggestion-card styling */
}

/* Success Cards */
.suggestion-card .bg-green-50 {
    animation: slideIn 0.3s ease-out;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

/* Alert Styles */
.alert {
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-warning {
    background-color: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}

/* Dark mode alert styles */
html.dark .alert-warning {
    background-color: #451a03;
    border: 1px solid #78350f;
    color: #fbbf24;
}


/* Utility Classes specific to drawer */
.space-y-3 > * + * {
    margin-top: 0.75rem;
}

/* Responsive */
@media (max-width: 640px) {
    #suggestions-drawer {
        width: 100vw;
    }
}

/* Scrollbar Styling */
#drawer-results-state > div:last-child {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

#drawer-results-state > div:last-child::-webkit-scrollbar {
    width: 8px;
}

#drawer-results-state > div:last-child::-webkit-scrollbar-track {
    background: #f1f5f9;
}

#drawer-results-state > div:last-child::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

#drawer-results-state > div:last-child::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* Dark mode scrollbar styling */
html.dark #drawer-results-state > div:last-child {
    scrollbar-color: #4b5563 #374151;
}

html.dark #drawer-results-state > div:last-child::-webkit-scrollbar-track {
    background: #374151;
}

html.dark #drawer-results-state > div:last-child::-webkit-scrollbar-thumb {
    background-color: #4b5563;
}

html.dark #drawer-results-state > div:last-child::-webkit-scrollbar-thumb:hover {
    background-color: #6b7280;
}

/* Expanded Content */
.expanded-content {
    /* Styles managed via inline display */
}

@keyframes expandIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Expand Button Icon Rotation */
.expand-icon {
    transition: transform 0.3s ease;
}

.expand-icon.fa-chevron-up {
    transform: rotate(180deg);
}

/* Animation for card removal */
@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

.suggestion-card.removing {
    animation: fadeOut 0.3s ease-out forwards;
}

