/* 重置基本樣式 */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: auto;
}

/* 修正 #app 樣式，避免影響正常頁面 */
#app {
    position: relative;
    height: 100vh;
    width: 100%;
    overflow: visible;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

    /* 只在載入時套用居中樣式 */
    #app.loading {
        display: flex;
        align-items: center;
        justify-content: center;
        background: #ffffff;
        overflow: hidden;
    }

/* Loading Animation Styles */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.system-logo {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.system-logo svg {
    width: 40px;
    height: 40px;
    color: #667eea;
}

.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
}

    .loading-spinner .circle {
        position: absolute;
        border: 4px solid rgba(255, 255, 255, 0.1);
        border-radius: 50%;
        animation: spin 1.5s linear infinite;
        width: 80px;
        height: 80px;
        border-top-color: rgba(255, 255, 255, 0.9);
    }

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: white;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    animation: textPulse 2s ease-in-out infinite;
    letter-spacing: 1px;
}

.loading-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-align: center;
    margin-top: -15px;
    animation: textPulse 2s ease-in-out infinite;
    animation-delay: 0.5s;
}

@keyframes textPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

/* Blazor 錯誤 UI 樣式 */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

    #blazor-error-ui .reload {
        color: #0066cc;
        text-decoration: underline;
    }

        #blazor-error-ui .reload:hover {
            text-decoration: none;
        }

/* 全域響應式樣式 */
.responsive-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
}

/* 卡片樣式 */
.product-card {
    margin-bottom: 16px;
    transition: all 0.2s ease-in-out;
}

    .product-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    }

/* Sticky Header 支援 */
.sticky-top {
    position: sticky;
    top: 64px;
    z-index: 100;
    background: white;
}

/* 隱藏/顯示輔助類 */
.d-mobile-none {
    display: none !important;
}

.d-mobile-flex {
    display: flex !important;
}

.d-mobile-block {
    display: block !important;
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }

/* 響應式設計斷點 */

/* 超小螢幕 (手機直向) */
@media (max-width: 599px) {
    .loading-container {
        gap: 20px;
        padding: 0 1rem;
    }

    .system-logo {
        width: 60px;
        height: 60px;
    }

        .system-logo svg {
            width: 30px;
            height: 30px;
        }

    .loading-spinner {
        width: 60px;
        height: 60px;
    }

        .loading-spinner .circle {
            width: 60px;
            height: 60px;
        }

    .loading-text {
        font-size: 18px;
    }

    .loading-subtitle {
        font-size: 12px;
    }

    .sticky-top {
        top: 56px;
    }

    .d-mobile-none {
        display: none !important;
    }

    .d-mobile-flex {
        display: flex !important;
    }

    .d-mobile-block {
        display: block !important;
    }
}

/* 小螢幕 (手機橫向/小平板) */
@media (min-width: 600px) and (max-width: 959px) {
    .loading-container {
        gap: 25px;
    }

    .loading-text {
        font-size: 19px;
    }

    .loading-subtitle {
        font-size: 13px;
    }
}

/* 中等螢幕 (平板) */
@media (min-width: 960px) and (max-width: 1279px) {
    .loading-container {
        gap: 30px;
    }
}

/* 大螢幕 (桌面) */
@media (min-width: 1280px) {
    .loading-container {
        gap: 35px;
    }

    .loading-text {
        font-size: 22px;
    }

    .loading-subtitle {
        font-size: 15px;
    }
}

/* 特大螢幕 */
@media (min-width: 1920px) {
    .loading-container {
        gap: 40px;
    }

    .loading-text {
        font-size: 24px;
    }

    .loading-subtitle {
        font-size: 16px;
    }
}

/* 高度適配 (橫向模式) */
@media (max-height: 600px) and (orientation: landscape) {
    .loading-container {
        gap: 15px;
    }

    .system-logo {
        width: 50px;
        height: 50px;
    }

        .system-logo svg {
            width: 25px;
            height: 25px;
        }

    .loading-spinner {
        width: 50px;
        height: 50px;
    }

        .loading-spinner .circle {
            width: 50px;
            height: 50px;
        }

    .loading-text {
        font-size: 16px;
    }

    .loading-subtitle {
        font-size: 11px;
    }
}

/* 無障礙和高對比度支援 */
@media (prefers-reduced-motion: reduce) {
    .loading-container,
    .system-logo,
    .loading-spinner .circle,
    .loading-text,
    .loading-subtitle {
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .system-logo {
        border: 2px solid #000;
    }

    .loading-text,
    .loading-subtitle {
        text-shadow: 1px 1px 0 #000;
    }
}

/* Print 樣式 */
@media print {
    #app {
        background: white;
        color: black;
    }

    .loading-container {
        animation: none;
    }

    .system-logo,
    .loading-spinner {
        display: none;
    }
}

