/* ============================================
   SUPPLYSPHERE ENHANCED PROFESSIONAL DESIGN
   Advanced UX/UI Standards for Enterprise Applications
   ============================================ */

/* ============================================
   ADVANCED MICRO-INTERACTIONS
   ============================================ */

/* Smooth Focus Rings - WCAG 2.1 Compliant */
*:focus-visible {
    outline: 3px solid var(--brand-primary);
    outline-offset: 2px;
    transition: outline-offset 150ms ease;
}

*:focus-visible:active {
    outline-offset: 0;
}

/* Enhanced Button Interactions */
.btn-enterprise {
    position: relative;
    overflow: hidden;
}

.btn-enterprise::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-enterprise:active::before {
    width: 300px;
    height: 300px;
}

/* Card Hover Effects with Depth */
.card-enterprise {
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, box-shadow;
}

.card-enterprise::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    opacity: 0;
    box-shadow: 0 20px 60px rgba(23, 43, 77, 0.25);
    transition: opacity 300ms ease;
    pointer-events: none;
}

.card-enterprise:hover::after {
    opacity: 1;
}

/* ============================================
   PROFESSIONAL LOADING STATES
   ============================================ */

/* Skeleton Screen Loader */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--neutral-200) 0%,
        var(--neutral-100) 50%,
        var(--neutral-200) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius-lg);
}

/* Spinner Loader - Professional */
.loader-professional {
    width: 48px;
    height: 48px;
    border: 4px solid var(--neutral-200);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin-professional 0.8s linear infinite;
}

@keyframes spin-professional {
    to {
        transform: rotate(360deg);
    }
}

/* Pulse Loader */
.loader-pulse {
    display: inline-flex;
    gap: 8px;
}

.loader-pulse span {
    width: 12px;
    height: 12px;
    background: var(--brand-primary);
    border-radius: 50%;
    animation: pulse-animation 1.4s ease-in-out infinite;
}

.loader-pulse span:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-pulse span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse-animation {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Progress Bar */
.progress-bar-professional {
    width: 100%;
    height: 4px;
    background: var(--neutral-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 300ms ease;
}

.progress-bar-indeterminate {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}

/* ============================================
   ADVANCED FORM COMPONENTS
   ============================================ */

/* Enhanced Input with Floating Label */
.form-group-floating {
    position: relative;
    margin-bottom: var(--space-6);
}

.form-input-floating {
    width: 100%;
    padding: 20px 16px 8px;
    font-size: 16px;
    border: 2px solid var(--neutral-200);
    border-radius: var(--radius-md);
    transition: all 200ms ease;
    background: var(--neutral-0);
}

.form-input-floating:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-pale);
}

.form-label-floating {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--neutral-500);
    pointer-events: none;
    transition: all 200ms ease;
}

.form-input-floating:focus + .form-label-floating,
.form-input-floating:not(:placeholder-shown) + .form-label-floating {
    top: 12px;
    font-size: 12px;
    color: var(--brand-primary);
    font-weight: 600;
}

/* Form Validation States */
.form-input-enterprise.is-valid {
    border-color: var(--brand-success);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2300875A'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

.form-input-enterprise.is-invalid {
    border-color: var(--brand-error);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23DE350B'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

.form-feedback {
    margin-top: var(--space-2);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-feedback.valid {
    color: var(--brand-success);
}

.form-feedback.invalid {
    color: var(--brand-error);
}

/* Custom Checkbox */
.checkbox-professional {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    user-select: none;
}

.checkbox-professional input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--neutral-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    transition: all 200ms ease;
}

.checkbox-professional input[type="checkbox"]:checked {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.checkbox-professional input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-professional input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Custom Radio Button */
.radio-professional {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    user-select: none;
}

.radio-professional input[type="radio"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--neutral-300);
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 200ms ease;
}

.radio-professional input[type="radio"]:checked {
    border-color: var(--brand-primary);
}

.radio-professional input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--brand-primary);
    border-radius: 50%;
}

/* Toggle Switch */
.toggle-professional {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    user-select: none;
}

.toggle-professional input[type="checkbox"] {
    appearance: none;
    width: 48px;
    height: 24px;
    background: var(--neutral-300);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
    transition: background 200ms ease;
}

.toggle-professional input[type="checkbox"]::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 20px;
    height: 20px;
    background: var(--neutral-0);
    border-radius: 50%;
    transition: transform 200ms ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-professional input[type="checkbox"]:checked {
    background: var(--brand-primary);
}

.toggle-professional input[type="checkbox"]:checked::after {
    transform: translateX(24px);
}

/* ============================================
   PROFESSIONAL TOOLTIPS
   ============================================ */

.tooltip-professional {
    position: relative;
    display: inline-block;
}

.tooltip-professional .tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: var(--neutral-900);
    color: var(--neutral-0);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: var(--z-tooltip);
    transition: all 200ms ease;
    pointer-events: none;
}

.tooltip-professional .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--neutral-900);
}

.tooltip-professional:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   PROFESSIONAL MODALS
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(23, 43, 77, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all 300ms ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-professional {
    background: var(--neutral-0);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-6);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-professional {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--neutral-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neutral-900);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--neutral-600);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 150ms ease;
}

.modal-close:hover {
    background: var(--neutral-100);
    color: var(--neutral-900);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: var(--space-6);
    border-top: 1px solid var(--neutral-200);
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

/* ============================================
   PROFESSIONAL ALERTS & NOTIFICATIONS
   ============================================ */

.alert-professional {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    border-left: 4px solid;
    display: flex;
    align-items: start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    animation: slideInDown 300ms ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.alert-message {
    font-size: 0.9375rem;
    line-height: 1.5;
}

.alert-success {
    background: var(--brand-success-light);
    border-color: var(--brand-success);
    color: var(--brand-success);
}

.alert-warning {
    background: var(--brand-warning-light);
    border-color: var(--brand-warning);
    color: #92400e;
}

.alert-error {
    background: var(--brand-error-light);
    border-color: var(--brand-error);
    color: var(--brand-error);
}

.alert-info {
    background: var(--color-info-light);
    border-color: var(--color-info);
    color: var(--color-info);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast-professional {
    background: var(--neutral-0);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-5);
    padding: var(--space-4);
    min-width: 320px;
    max-width: 400px;
    display: flex;
    align-items: start;
    gap: var(--space-3);
    animation: slideInRight 300ms ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   PROFESSIONAL DATA TABLES
   ============================================ */

.table-professional {
    width: 100%;
    border-collapse: collapse;
    background: var(--neutral-0);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-2);
}

.table-professional thead {
    background: var(--neutral-50);
}

.table-professional th {
    padding: var(--space-4) var(--space-5);
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--neutral-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--neutral-200);
}

.table-professional td {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--neutral-100);
    color: var(--neutral-800);
}

.table-professional tbody tr {
    transition: background 150ms ease;
}

.table-professional tbody tr:hover {
    background: var(--neutral-50);
}

.table-professional tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   PROFESSIONAL BREADCRUMBS
   ============================================ */

.breadcrumb-professional {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) 0;
    font-size: 0.875rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--neutral-600);
}

.breadcrumb-item a {
    color: var(--neutral-600);
    text-decoration: none;
    transition: color 150ms ease;
}

.breadcrumb-item a:hover {
    color: var(--brand-primary);
}

.breadcrumb-item.active {
    color: var(--neutral-900);
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--neutral-400);
}

/* ============================================
   PROFESSIONAL PAGINATION
   ============================================ */

.pagination-professional {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    justify-content: center;
    margin: var(--space-8) 0;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--neutral-0);
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
    color: var(--neutral-700);
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
    text-decoration: none;
}

.pagination-btn:hover:not(.active):not(:disabled) {
    background: var(--brand-primary-pale);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.pagination-btn.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: var(--neutral-0);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
   PROFESSIONAL TABS
   ============================================ */

.tabs-professional {
    border-bottom: 2px solid var(--neutral-200);
    display: flex;
    gap: var(--space-2);
}

.tab-btn {
    padding: var(--space-4) var(--space-5);
    background: none;
    border: none;
    color: var(--neutral-600);
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: color 150ms ease;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--brand-primary);
    transform: scaleX(0);
    transition: transform 200ms ease;
}

.tab-btn:hover {
    color: var(--brand-primary);
}

.tab-btn.active {
    color: var(--brand-primary);
}

.tab-btn.active::after {
    transform: scaleX(1);
}

.tab-content {
    padding: var(--space-6) 0;
}

.tab-panel {
    display: none;
    animation: fadeIn 300ms ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   Z-INDEX SCALE (Extended)
   ============================================ */

:root {
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: var(--space-4);
    background: var(--brand-primary);
    color: var(--neutral-0);
    text-decoration: none;
    font-weight: 600;
}

.skip-to-main:focus {
    left: var(--space-4);
    top: var(--space-4);
}

/* 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;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-enterprise {
        border: 2px solid currentColor;
    }
    
    .card-enterprise {
        border: 2px solid var(--neutral-900);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .nav-enterprise,
    .footer-professional,
    .btn-enterprise,
    .modal-overlay {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card-enterprise {
        box-shadow: none;
        border: 1px solid #000;
    }
}
