/**
 * Additional Global Styles for V3 Dashboard
 * Loading states, modals, and utility classes
 */

/* Global Loader */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.global-loader .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-primary, #0F172A);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Confirm Modal */
#confirmModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 1rem;
}

#confirmModal .modal-content {
    background: var(--color-bg-primary, #fff);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Log Detail Modal */
#logDetailModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 1rem;
}

#logDetailModal .modal-content {
    background: var(--color-bg-primary, #fff);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    overflow-y: auto;
}

/* Search Results Dropdown */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-primary, #fff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0.5rem;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--color-text-primary, #111827);
    text-decoration: none;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background: var(--color-bg-secondary, #f9fafb);
}

.search-result-item i {
    color: var(--color-text-secondary, #6b7280);
    width: 20px;
    text-align: center;
}

/* Notifications Dropdown */
.notifications-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--color-bg-primary, #fff);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 0.5rem;
}

.notifications-dropdown .dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.notifications-dropdown .dropdown-header h4 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.notifications-dropdown .dropdown-body {
    max-height: 300px;
    overflow-y: auto;
}

.notifications-dropdown .dropdown-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--color-border, #e5e7eb);
    text-align: center;
}

.notifications-dropdown .dropdown-footer a {
    font-size: 0.75rem;
    color: var(--color-primary, #0F172A);
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    transition: background-color 0.2s;
}

.notification-item:hover {
    background: var(--color-bg-secondary, #f9fafb);
}

.notification-item.unread {
    background: rgba(15, 23, 42, 0.08);
}

.notification-item i {
    color: var(--color-primary, #0F172A);
    margin-top: 2px;
}

.notification-item p {
    font-size: 0.875rem;
    margin: 0;
    color: var(--color-text-primary, #111827);
}

/* Tool Content Hidden State */
.tool-content.hidden {
    display: none;
}

/* Slide Out Animation */
@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.animate-slide-out-right {
    animation: slideOutRight 0.3s ease forwards;
}

/* Form Validation */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--color-danger, #ef4444);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Outline Badges */
.badge-outline-primary {
    background: transparent;
    border: 1px solid var(--color-primary, #0F172A);
    color: var(--color-primary, #0F172A);
}

.badge-outline-secondary {
    background: transparent;
    border: 1px solid var(--color-text-secondary, #6b7280);
    color: var(--color-text-secondary, #6b7280);
}

/* Surface Color */
.bg-surface {
    background-color: var(--color-bg-secondary, #f9fafb);
}

/* Border Color */
.border-border {
    border-color: var(--color-border, #e5e7eb);
}

/* Space Y */
.space-y-4 > * + * {
    margin-top: 1rem;
}

/* Font Mono */
.font-mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
}

/* W-auto for selects */
.w-auto {
    width: auto !important;
}
