/* Salesforce Lightning Design System Enhancements */

/* Table Column Alignment Fix */
table {
    border-collapse: collapse;
    border-spacing: 0;
}

table th,
table td {
    box-sizing: border-box;
}

/* Ensure table headers and cells align properly */
.slds-table th,
.slds-table td,
.alerts-table th,
.alerts-table td,
.data-table th,
.data-table td {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* Highlight on hover using box-shadow to avoid layout shift */
.use-case-table tbody tr,
.slds-table tbody tr {
    border-left: none;
}

.use-case-table tbody tr:hover,
.slds-table tbody tr:hover {
    box-shadow: inset 4px 0 0 var(--slds-c-brand);
}

/* Smooth scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--slds-c-neutral-3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--slds-c-neutral-6);
    border-radius: 4px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--slds-c-neutral-8);
}

/* Focus visible outline for accessibility */
:focus-visible {
    outline: 2px solid var(--slds-c-brand);
    outline-offset: 2px;
}

/* Selection color */
::selection {
    background: rgba(1, 118, 211, 0.25);
    color: var(--slds-c-neutral-10);
}

/* Improved checkbox styling */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--slds-c-brand);
    transition: all 0.15s ease;
}

input[type="checkbox"]:hover {
    transform: scale(1.1);
}

input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Link styling */
a {
    color: var(--slds-c-brand);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--slds-c-brand-dark);
    text-decoration: underline;
}

a:active {
    color: var(--slds-c-brand-darker);
}

/* Improved flash message animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

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

/* Empty state illustration */
.empty-state {
    text-align: center;
    padding: var(--slds-spacing-x-large);
    background: linear-gradient(135deg, var(--slds-c-neutral-1) 0%, var(--slds-c-neutral-2) 100%);
    border-radius: var(--slds-border-radius-medium);
    border: 2px dashed var(--slds-c-neutral-5);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--slds-spacing-medium);
    opacity: 0.5;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--slds-c-neutral-9);
    margin: 0 0 var(--slds-spacing-small) 0;
}

.empty-state-message {
    font-size: 0.875rem;
    color: var(--slds-c-neutral-8);
    margin: 0 0 var(--slds-spacing-large) 0;
    line-height: 1.5;
}

/* Progress bar */
.slds-progress-bar {
    height: 8px;
    background: var(--slds-c-neutral-4);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.slds-progress-bar__value {
    height: 100%;
    background: linear-gradient(90deg, var(--slds-c-brand) 0%, var(--slds-c-brand-light) 100%);
    transition: width 0.3s ease;
    position: relative;
}

.slds-progress-bar__value::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

/* Modal backdrop animation */
.modal-backdrop {
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Tooltip enhancements */
.tooltip {
    animation: fadeIn 0.15s ease-out;
}

.tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(3, 45, 96, 0.95);
}

/* Data table enhancements */
.use-case-table tbody tr,
.slds-table tbody tr {
    /* position: static to avoid layout shifts */
}

/* Hover indicator handled via box-shadow on tr:hover instead of ::before pseudo-element
   (::before on <tr> creates anonymous table cells that break column alignment) */

/* Button ripple effect on click */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Badge pulse animation for active states */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(4, 132, 75, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(4, 132, 75, 0);
    }
}

.status-badge.active {
    animation: pulse 2s infinite;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--slds-c-neutral-3) 25%, var(--slds-c-neutral-4) 50%, var(--slds-c-neutral-3) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--slds-border-radius-medium);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Card hover lift effect */
.slds-card:hover,
.content-panel:hover {
    animation: cardLift 0.3s ease forwards;
}

@keyframes cardLift {
    to {
        transform: translateY(-4px);
    }
}

/* Success checkmark animation */
.success-checkmark {
    display: inline-block;
    animation: checkmarkBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkmarkBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Error shake animation */
.error-shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Responsive utilities */
@media (max-width: 768px) {
    #navigation,
    #useCaseNavigation {
        width: 100%;
        max-width: 280px;
    }

    #mainContent {
        padding: var(--slds-spacing-medium);
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }

    .use-case-table,
    .slds-table {
        font-size: 0.75rem;
    }

    .use-case-table th,
    .use-case-table td,
    .slds-table th,
    .slds-table td {
        padding: var(--slds-spacing-x-small);
    }
}

/* Print styles */
@media print {
    #navigation,
    #useCaseNavigation,
    .action-buttons,
    button {
        display: none !important;
    }

    .content-panel {
        box-shadow: none;
        border: 1px solid #000;
    }

    body {
        background: white;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    button,
    .slds-badge,
    .status-badge {
        border-width: 2px;
    }

    .link,
    .node rect {
        stroke-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode preparation (future enhancement) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles would go here if needed */
}
