/* === 全局樣式 === */
:root {
    --footer-height: 50px;
    --bg-base: #f8f9fa;
    --text-primary: #343a40;
    --text-secondary: #6c757d;
    --accent-start: #3B82F6;
    --accent-end: #7C3AED;
    --card-radius: 1.5rem;
    --dashboard-card-radius: 0.75rem;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --border-color: #dee2e6;
}

html, body {
    font-family: 'Roboto', sans-serif;
}

body {
    background: var(--bg-base);
    color: var(--text-primary);
    padding-top: 70px;
}

.body-with-footer {
    padding-bottom: var(--footer-height);
}

.navbar {
    background-color: #fff !important;
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important;
}

.navbar-brand {
    color: var(--accent-start) !important;
    font-family: 'Orbitron', sans-serif;
}

.footer-fixed {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: var(--footer-height);
    line-height: var(--footer-height);
    background-color: #ffffff;
    border-top: 1px solid #e7e7e7;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    z-index: 1030;
}


/* ================================================================================
|   登錄頁樣式 (已鎖定 | 不可觸碰的最終版本)                                  |
================================================================================ */
.login-body {
    padding: 0 !important;
    background: none;
    overflow-x: hidden;
}

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: #f4f7f6;
    background-image: linear-gradient(180deg, #ffffff 0%, #e8f0f2 100%);
    z-index: -1;
}

.unified-login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    padding: 1rem;
}

.unified-showcase-card {
    width: 100%;
    max-width: 960px;
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    overflow: hidden;
}

.unified-card-left {
    width: 55%;
    padding: 3rem;
    background: linear-gradient(45deg, var(--accent-start), var(--accent-end));
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.unified-card-right {
    width: 45%;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

    .unified-card-right .form-title {
        text-align: center;
    }

    .unified-card-right .form-subtitle {
        text-align: center;
        color: var(--text-secondary);
    }

.form-floating > .form-control {
    border-radius: 0.6rem;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease-in-out;
}

    .form-floating > .form-control:focus {
        border-color: var(--accent-start);
        box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
    }

.btn-login {
    background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
    color: #fff;
    border: none;
    border-radius: 0.6rem;
    transition: all 0.3s ease;
    padding: 0.9rem 1.5rem;
    font-weight: 500;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

    .btn-login:hover {
        color: #fff;
        box-shadow: 0 6px 20px rgba(124, 61, 237, 0.4);
        transform: translateY(-3px);
    }

.showcase-header {
    text-align: center;
}

    .showcase-header .nfc-animation {
        position: relative;
        width: 120px;
        height: 120px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .showcase-header .nfc-card {
        width: 50px;
        height: 75px;
        background: rgba(255, 255, 255, 0.2);
        border: 2px solid #fff;
        border-radius: 8px;
        z-index: 10;
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    }

    .showcase-header .nfc-scanner {
        position: absolute;
        width: 80px;
        height: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        animation: pulse 2s infinite ease-out;
        z-index: 5;
    }

#productCarousel.carousel {
    margin-top: 2rem;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.text-danger {
    color: #dc3545 !important;
}


/* === 儀表板及內部頁面通用樣式 === */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-family: 'Orbitron', sans-serif;
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 700;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filter-toolbar {
    padding: 1rem 1.5rem;
    background-color: #fff;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.search-box {
    position: relative;
    min-width: 250px;
}

    .search-box svg {
        position: absolute;
        left: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-secondary);
        pointer-events: none;
    }

    .search-box .form-control {
        padding-left: 2.5rem;
        border-radius: 2rem;
    }

.btn-primary-gradient {
    background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

    .btn-primary-gradient:hover {
        color: #fff;
        box-shadow: 0 4px 15px rgba(124, 61, 237, 0.3);
        transform: translateY(-2px);
    }

.card-dashboard {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--dashboard-card-radius);
    box-shadow: var(--card-shadow);
}

    .card-dashboard .card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: #fff;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--border-color);
    }

        .card-dashboard .card-header h3 {
            margin: 0;
            font-size: 1.25rem;
            font-weight: 500;
        }

    .card-dashboard .card-body {
        padding: 0;
    }

.table-modern {
    margin-bottom: 0;
}

    .table-modern thead th {
        background-color: #f8f9fa;
        border-bottom: 2px solid var(--border-color);
        border-top: 0;
        font-weight: 500;
        padding: 1rem 1.5rem;
        white-space: nowrap;
    }

    .table-modern tbody tr:hover {
        background-color: #f1f3f5;
    }

    .table-modern td {
        padding: 1rem 1.5rem;
        vertical-align: middle;
        border-top: 1px solid var(--border-color);
    }

    .table-modern tbody tr:first-child td {
        border-top: 0;
    }

.url-cell {
    max-width: 300px;
    white-space: normal;
    word-break: break-all;
    font-size: 0.9rem;
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    line-height: 1;
    transition: background-color 0.2s ease;
    vertical-align: middle;
}

    .btn-icon:hover {
        background-color: #e9ecef;
    }

.gradient-text {
    background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
}

.card-action {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--dashboard-card-radius);
    box-shadow: var(--card-shadow);
    text-align: center;
    padding: 2rem 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

    .card-action:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
        color: var(--accent-start);
    }

    .card-action .card-icon {
        margin: 0 auto 1.5rem auto;
        width: 60px;
        height: 60px;
        background: linear-gradient(45deg, var(--accent-start), var(--accent-end));
        color: #fff;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

#homepageCarousel {
    box-shadow: 0 1rem 3rem rgba(0,0,0,.175);
    border-radius: var(--dashboard-card-radius);
    overflow: hidden;
    max-height: 650px;
}

    #homepageCarousel, #homepageCarousel .carousel-inner, #homepageCarousel .carousel-item {
        height: 100%;
    }

        #homepageCarousel .carousel-item img {
            height: 100%;
            width: 100%;
            object-fit: cover;
            aspect-ratio: 1 / 1;
        }

        #homepageCarousel .carousel-caption {
            position: absolute;
            z-index: 2;
            right: 5%;
            bottom: 1.25rem;
            left: 5%;
            padding: 1.25rem;
            color: #fff;
            text-align: left;
            text-shadow: 0 1px 2px rgba(0,0,0,0.6);
            background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
            border-bottom-left-radius: var(--dashboard-card-radius);
            border-bottom-right-radius: var(--dashboard-card-radius);
        }

            #homepageCarousel .carousel-caption h5 {
                font-size: 1.5rem;
                font-weight: 500;
            }

            #homepageCarousel .carousel-caption p {
                font-size: 1rem;
                margin-bottom: 1rem;
            }


/* === 響應式樣式 === */
@media (max-width: 992px) {
    .unified-showcase-card {
        flex-direction: column;
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
    }

    .unified-card-left, .unified-card-right {
        width: 100%;
        padding: 2rem;
    }

    .unified-card-left {
        justify-content: flex-start;
        gap: 0rem; /* [關鍵修正] 縮小移動端卡片內間距 */
    }

        .unified-card-left .showcase-header {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 1.5rem;
            text-align: left;
        }

            .unified-card-left .showcase-header .nfc-animation {
                margin: 0;
                flex-shrink: 0;
            }

            .unified-card-left .showcase-header .showcase-text .illustration-title,
            .unified-card-left .showcase-header .showcase-text .illustration-subtitle {
                margin-top: 0;
                margin-bottom: 0.25rem;
            }
}

@media (max-width: 768px) {
    .table-modern thead {
        display: none;
    }

    .table-modern tr {
        display: block;
        background-color: #fff;
        border: 1px solid var(--border-color);
        border-radius: var(--dashboard-card-radius);
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: var(--card-shadow);
    }

    .table-modern td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        min-height: 38px;
    }

    .table-modern tr td:last-child {
        border-bottom: none;
        padding-top: 1rem;
    }

    .table-modern td::before {
        content: attr(data-label);
        display: block;
        font-weight: 500;
        color: var(--text-secondary);
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }

    #homepageCarousel .carousel-caption {
        display: block !important;
        padding: 1rem;
    }

        #homepageCarousel .carousel-caption h5 {
            font-size: 1.1rem;
        }

        #homepageCarousel .carousel-caption p {
            font-size: 0.9rem;
            margin-bottom: 0.75rem;
        }

        #homepageCarousel .carousel-caption .btn {
            padding: 0.25rem 0.5rem;
            font-size: 0.8rem;
        }
}

@media (max-width: 576px) {
    .unified-card-left .showcase-header .illustration-title {
        font-size: 1.75rem;
    }
}
