/* Enhanced UI Components Styles */

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: currentColor;
}

.toast--visible {
    transform: translateX(0);
    opacity: 1;
}

.toast--dismissing {
    transform: translateX(100%);
    opacity: 0;
}

.toast--success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.toast--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.toast--warning {
    background: #fffbeb;
    border: 1px solid #fed7aa;
    color: #d97706;
}

.toast--info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
}

.toast__icon {
    flex-shrink: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
}

.toast__content {
    flex: 1;
}

.toast__message {
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.4;
}

.toast__close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
    color: inherit;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast__close:hover {
    opacity: 1;
}

/* Loading States */
.loading-state {
    position: relative;
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    min-height: 120px;
}

.loading-message {
    margin-top: 1rem;
    color: var(--color-text-secondary, #64748b);
    font-size: 0.9rem;
}

/* Spinners */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 212, 170, 0.2);
    border-top-color: #00d4aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner--small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner--large {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay--visible {
    opacity: 1;
    visibility: visible;
}

.loading-overlay__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--color-bg-secondary, #141b26);
    border-radius: 12px;
    border: 1px solid var(--color-border, #2d3748);
}

.loading-overlay__message {
    color: var(--color-text-primary, #ffffff);
    font-size: 1.1rem;
    font-weight: 500;
}

.loading-active {
    overflow: hidden;
}

/* Skeleton Loaders */
.skeleton {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary, #1e2a3a) 25%,
        var(--color-border, #2d3748) 50%,
        var(--color-bg-tertiary, #1e2a3a) 75%
    );
    background-size: 200% 100%;
}

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

.skeleton__line {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.skeleton__line--title {
    height: 1.5rem;
    width: 60%;
}

.skeleton__line--text {
    width: 100%;
}

.skeleton__line--short {
    width: 40%;
}

.skeleton--card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
}

.skeleton__image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    flex-shrink: 0;
}

.skeleton__content {
    flex: 1;
}

.skeleton--table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.skeleton__row {
    display: flex;
    gap: 1rem;
}

.skeleton__cell {
    height: 1rem;
    flex: 1;
    border-radius: 4px;
}

.skeleton--chart {
    padding: 1rem;
    border-radius: 8px;
}

.skeleton__chart-header {
    margin-bottom: 1rem;
}

.skeleton__chart-body {
    height: 200px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.skeleton__chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    width: 100%;
    height: 100%;
}

.skeleton__chart-bar {
    flex: 1;
    border-radius: 2px;
    min-height: 20px;
}

/* Form Enhancements */
.field {
    position: relative;
    margin-bottom: 1rem;
}

.field--error .input,
.field--error .select,
.field--error .textarea {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field-error {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.field-error::before {
    content: '⚠';
    font-size: 0.9rem;
}

/* Input States */
.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--color-primary, #00d4aa);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--color-bg-tertiary, #1e2a3a);
}

/* Button Enhancements */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn--loading {
    color: transparent;
    pointer-events: none;
}

.btn--loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Card Hover Effects */
.card {
    transition: all 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card--interactive {
    cursor: pointer;
}

/* Progress Indicators */
.progress {
    width: 100%;
    height: 8px;
    background: var(--color-bg-tertiary, #1e2a3a);
    border-radius: 4px;
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    background: linear-gradient(90deg, #00d4aa, #00a389);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

.progress__bar--animated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: progress-shine 1.5s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Status Indicators */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status--online { color: #10b981; }
.status--offline { color: #ef4444; }
.status--pending { color: #f59e0b; }
.status--inactive { color: #64748b; }

/* Pulse Animation */
.status--online::before {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-secondary, #64748b);
}

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text-primary, #ffffff);
}

.empty-state__description {
    max-width: 400px;
    margin: 0 auto 1.5rem;
    line-height: 1.5;
}

/* Tooltips */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1000;
    margin-bottom: 5px;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
    
    .toast {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .loading-content {
        padding: 1.5rem;
        min-height: 80px;
    }
    
    .skeleton--card {
        flex-direction: column;
    }
    
    .skeleton__image {
        width: 100%;
        height: 120px;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: light) {
    .toast--success {
        background: #f0fdf4;
        color: #166534;
    }
    
    .toast--error {
        background: #fef2f2;
        color: #dc2626;
    }
    
    .toast--warning {
        background: #fffbeb;
        color: #d97706;
    }
    
    .toast--info {
        background: #eff6ff;
        color: #2563eb;
    }
}