/* ==================== TOAST NOTIFICATIONS ==================== */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

@media (max-width: 768px) {
    #toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
        top: 10px;
    }
}

.toast {
    animation: slideInRight 0.3s ease-out;
    pointer-events: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    background: white;
    border-left: 4px solid;
}

.toast.closing {
    animation: slideOutRight 0.3s ease-in forwards;
}

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

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

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    min-height: 60px;
}

.toast-icon {
    font-size: 1.5rem;
    font-weight: bold;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.toast-message {
    flex: 1;
    color: var(--text-color);
    font-weight: 500;
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-color);
}

/* Toast Type Styles */
.toast.success {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.toast.success .toast-icon {
    color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.toast.warning .toast-icon {
    color: #f59e0b;
}

.toast.info {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
}

.toast.info .toast-icon {
    color: #3b82f6;
}

/* ==================== LOADING INDICATORS ==================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8888;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

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

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-hover);
}

.spinner-ring {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(109, 40, 217, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.spinner-circle {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 4px solid transparent;
    border-radius: 50%;
    border-right-color: var(--accent-color);
    animation: spin 2s linear infinite reverse;
}

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

.loading-text {
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
}

/* Inline Spinner */
.inline-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--primary-color);
    font-weight: 500;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(109, 40, 217, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

/* ==================== SKELETON LOADERS ==================== */

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

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

.skeleton-card {
    padding: 16px;
    border-radius: 12px;
    background: white;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.skeleton-img {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.skeleton-line {
    height: 12px;
    border-radius: 4px;
    margin: 8px 0;
}

.skeleton-btn {
    height: 40px;
    border-radius: 8px;
    width: 100%;
    margin-top: 12px;
}

.skeleton-order-card {
    padding: 16px;
    border-radius: 12px;
    background: white;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.skeleton-row {
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-row td {
    padding: 12px;
}

.skeleton-row td .skeleton-line {
    height: 20px;
    margin: 0;
}

/* Grid for skeleton loaders */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

@media (max-width: 768px) {
    .skeleton-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
}

/* ==================== EMPTY STATES ==================== */

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-color) 0%, rgba(109, 40, 217, 0.05) 100%);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
    animation: fadeIn 0.3s ease-out;
}

.empty-state-content {
    max-width: 400px;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    display: 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.5rem;
    color: var(--secondary-color);
    margin-bottom: 8px;
    font-weight: 700;
}

.empty-state-description {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.empty-state-action {
    margin-top: 16px;
}

/* Specific empty states */
.empty-cart,
.empty-orders,
.empty-search {
    padding: 60px 20px;
}

/* ==================== CONFIRMATION MODAL ==================== */

.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.confirm-modal.visible {
    background-color: rgba(0, 0, 0, 0.6);
    opacity: 1;
    visibility: visible;
}

.confirm-modal-content {
    background: white;
    border-radius: 12px;
    padding: 32px;
    max-width: 400px;
    box-shadow: var(--shadow-hover);
    animation: slideUp 0.3s ease-out;
}

.confirm-modal.visible .confirm-modal-content {
    animation: slideUp 0.3s ease-out;
}

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

.confirm-modal-content h3 {
    margin-bottom: 12px;
    color: var(--secondary-color);
}

.confirm-modal-content p {
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-modal-actions button {
    flex: 1;
    margin: 0;
}

@media (max-width: 480px) {
    .confirm-modal-content {
        padding: 24px;
    }

    .confirm-modal-actions {
        flex-direction: column;
    }

    .confirm-modal-actions button {
        width: 100%;
    }
}

/* ==================== BUTTON STATES ==================== */

.btn:disabled,
.btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

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

.show-when-loading {
    display: none;
}

.hide-when-loading {
    display: block;
}

.loading .show-when-loading {
    display: block;
}

.loading .hide-when-loading {
    display: none;
}

.opacity-50 {
    opacity: 0.5;
    pointer-events: none;
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */

@media (max-width: 768px) {
    .loading-spinner {
        padding: 30px 20px;
    }

    .spinner-ring {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }

    .empty-state {
        min-height: 300px;
    }

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

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

/* ==================== ANIMATION UTILITIES ==================== */

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

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

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* ==================== PAGINATION ==================== */

.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin: 20px 0;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-color);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition);
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.pagination-btn:active:not(:disabled) {
    transform: translateY(0);
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--text-muted);
}

.pagination-ellipsis {
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px 4px;
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 12px;
    white-space: nowrap;
}

.pagination-info-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 15px 0;
    text-align: center;
}

.quick-jump {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    justify-content: center;
    flex-wrap: wrap;
}

.quick-jump label {
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
}

.page-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 100px;
    font-size: 0.95rem;
}

.page-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.1);
}

.quick-jump-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.quick-jump-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Responsive Pagination */
@media (max-width: 768px) {
    .pagination-controls {
        padding: 15px;
        gap: 6px;
    }

    .pagination-btn {
        padding: 6px 10px;
        font-size: 0.9rem;
        min-width: 36px;
    }

    .pagination-info {
        margin-left: 8px;
        font-size: 0.85rem;
    }

    .quick-jump {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }

    .page-input {
        width: 80px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .pagination-controls {
        padding: 12px;
        gap: 4px;
    }

    .pagination-btn {
        padding: 6px 8px;
        font-size: 0.85rem;
        min-width: 32px;
    }

    .pagination-prev::before,
    .pagination-next::after {
        display: none;
    }

    .pagination-prev {
        width: 36px;
    }

    .pagination-next {
        width: 36px;
    }

    .pagination-info {
        display: none;
    }

    .quick-jump label {
        font-size: 0.9rem;
    }

    .page-input {
        width: 60px;
        padding: 6px 8px;
        font-size: 0.85rem;
    }

    .quick-jump-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}
