/* ========================================
   Loading States, Empty States, Error States
   ======================================== */

/* ========================================
   SKELETON LOADING STYLES
   ======================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

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

/* Skeleton variations */
.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text-lg {
    height: 1.5rem;
    margin-bottom: 0.5rem;
}

.skeleton-heading {
    height: 2rem;
    margin-bottom: 1rem;
    width: 60%;
}

.skeleton-stat {
    height: 3rem;
    margin-bottom: 0.5rem;
}

.skeleton-card {
    height: 200px;
    border-radius: 10px;
}

.skeleton-button {
    height: 44px;
    border-radius: 5px;
}

.skeleton-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

/* Statistics Skeleton */
.skeleton-stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 767.98px) {
    .skeleton-stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

.skeleton-stat-box {
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 12px;
    min-height: 140px;
}

.skeleton-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 auto 1rem;
}

.skeleton-stat-value {
    height: 2.5rem;
    width: 60%;
    margin: 0 auto 0.5rem;
}

.skeleton-stat-label {
    height: 1rem;
    width: 80%;
    margin: 0 auto;
}

/* Alert Card Skeleton */
.skeleton-alert-card {
    min-height: 250px;
    padding: 1rem;
    background-color: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.skeleton-alert-badge {
    width: 80px;
    height: 24px;
    margin-bottom: 1rem;
}

.skeleton-alert-route {
    height: 2rem;
    margin-bottom: 1rem;
}

.skeleton-alert-price {
    height: 3rem;
    width: 50%;
    margin-bottom: 1rem;
}

.skeleton-alert-details {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-alert-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.skeleton-alert-action-btn {
    height: 44px;
    flex: 1;
}

/* ========================================
   LOADING SPINNER STYLES
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.loading-spinner-container {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--brand-yellow, #f4c430);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--brand-gray, #4a4a4a);
    font-weight: 600;
    font-size: 1.1rem;
}

/* Inline loading spinner (for buttons) */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading .btn-text {
    opacity: 0;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Loading state for form submission */
.form-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.form-loading::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.form-loading::after {
    content: "";
    position: absolute;
    width: 40px;
    height: 40px;
    top: 50%;
    left: 50%;
    margin-left: -20px;
    margin-top: -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--brand-yellow, #f4c430);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

/* ========================================
   EMPTY STATE STYLES
   ======================================== */

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background-color: #fafafa;
    border-radius: 10px;
    border: 2px dashed #dee2e6;
    margin: 2rem 0;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
    display: block;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--brand-dark, #3d3d3d);
    margin-bottom: 1rem;
}

.empty-state-description {
    font-size: 1rem;
    color: var(--brand-light-gray, #636363);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.empty-state-action {
    margin-top: 1.5rem;
}

.empty-state-action .btn {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Empty state variations */
.empty-state.empty-state-sm {
    padding: 2rem 1.5rem;
}

.empty-state.empty-state-sm .empty-state-icon {
    font-size: 3rem;
}

.empty-state.empty-state-sm .empty-state-title {
    font-size: 1.25rem;
}

.empty-state.empty-state-sm .empty-state-description {
    font-size: 0.95rem;
}

/* Empty state with suggestions */
.empty-state-suggestions {
    margin-top: 1.5rem;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state-suggestions-title {
    font-weight: 600;
    color: var(--brand-dark, #3d3d3d);
    margin-bottom: 0.75rem;
}

.empty-state-suggestions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.empty-state-suggestions li {
    padding: 0.5rem 0;
    color: var(--brand-light-gray, #636363);
}

.empty-state-suggestions li::before {
    content: "• ";
    color: var(--brand-yellow, #f4c430);
    font-weight: bold;
    margin-right: 0.5rem;
}

/* Mobile responsive */
@media (max-width: 767.98px) {
    .empty-state {
        padding: 2rem 1rem;
    }

    .empty-state-icon {
        font-size: 3rem;
    }

    .empty-state-title {
        font-size: 1.25rem;
    }

    .empty-state-description {
        font-size: 0.95rem;
    }

    .empty-state-action .btn {
        font-size: 1rem;
        padding: 0.65rem 1.5rem;
    }
}

/* ========================================
   ERROR STATE STYLES
   ======================================== */

.error-state {
    text-align: center;
    padding: 3rem 2rem;
    background-color: #fff5f5;
    border-radius: 10px;
    border: 2px solid #f8d7da;
    margin: 2rem 0;
}

.error-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: #dc3545;
    display: block;
}

.error-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #721c24;
    margin-bottom: 1rem;
}

.error-state-description {
    font-size: 1rem;
    color: #721c24;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.error-state-details {
    background-color: white;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    padding: 1rem;
    margin-top: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.error-state-details-title {
    font-weight: 600;
    color: #721c24;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.error-state-details-text {
    font-size: 0.9rem;
    color: #856404;
    font-family: monospace;
    word-break: break-all;
}

.error-state-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.error-state-actions .btn {
    padding: 0.65rem 1.5rem;
    font-weight: 600;
}

/* Error state variations */
.error-state.error-state-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.error-state.error-state-warning .error-state-icon {
    color: #856404;
}

.error-state.error-state-warning .error-state-title,
.error-state.error-state-warning .error-state-description {
    color: #856404;
}

/* Network error specific styling */
.error-state.error-state-network {
    background-color: #e7f3ff;
    border-color: #bee5eb;
}

.error-state.error-state-network .error-state-icon {
    color: #0c5460;
}

.error-state.error-state-network .error-state-title,
.error-state.error-state-network .error-state-description {
    color: #0c5460;
}

/* Inline error messages (for forms) */
.error-message {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    color: #721c24;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.error-message-icon {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

.error-message-text {
    flex: 1;
}

/* Mobile responsive */
@media (max-width: 767.98px) {
    .error-state {
        padding: 2rem 1rem;
    }

    .error-state-icon {
        font-size: 3rem;
    }

    .error-state-title {
        font-size: 1.25rem;
    }

    .error-state-description {
        font-size: 0.95rem;
    }

    .error-state-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .error-state-actions .btn {
        width: 100%;
    }
}

/* ========================================
   NO RESULTS STATE (Search/Filter)
   ======================================== */

.no-results-state {
    text-align: center;
    padding: 3rem 2rem;
    background-color: #f8f9fa;
    border-radius: 10px;
    margin: 2rem 0;
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--brand-dark, #3d3d3d);
    margin-bottom: 1rem;
}

.no-results-description {
    font-size: 1rem;
    color: var(--brand-light-gray, #636363);
    margin-bottom: 1rem;
}

.no-results-suggestions {
    margin-top: 1.5rem;
}

.no-results-suggestions-title {
    font-weight: 600;
    color: var(--brand-dark, #3d3d3d);
    margin-bottom: 0.75rem;
}

.no-results-suggestions ul {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    max-width: 400px;
    text-align: left;
}

.no-results-suggestions li {
    padding: 0.5rem 0;
    color: var(--brand-light-gray, #636363);
}

.no-results-suggestions li::before {
    content: "• ";
    color: var(--brand-yellow, #f4c430);
    font-weight: bold;
    margin-right: 0.5rem;
}

.no-results-actions {
    margin-top: 1.5rem;
}

/* ========================================
   LOADING TRANSITION STATES
   ======================================== */

/* Fade in animation for content loaded */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Slide up animation */
.slide-up {
    animation: slideUp 0.4s ease-out;
}

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

/* Prevent layout shift during loading */
.loading-placeholder {
    min-height: 200px;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ARIA live regions for loading states */
.loading-announcement {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Focus visible for keyboard navigation */
.error-state-actions .btn:focus-visible,
.empty-state-action .btn:focus-visible,
.no-results-actions .btn:focus-visible {
    outline: 2px solid var(--brand-yellow, #f4c430);
    outline-offset: 2px;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Hide element */
.hidden {
    display: none !important;
}

/* Show element */
.show {
    display: block !important;
}

/* Disable interactions */
.disabled {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

/* Loading state for entire sections */
.section-loading {
    position: relative;
    min-height: 200px;
}

.section-loading::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.section-loading::after {
    content: "";
    position: absolute;
    width: 50px;
    height: 50px;
    top: 50%;
    left: 50%;
    margin-left: -25px;
    margin-top: -25px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--brand-yellow, #f4c430);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}
