/* ================================================================
   Backstage Shared Design System
   ================================================================ */

/* ---- Login Page ---- */
.login-wrapper {
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2.5rem 2rem;
    text-align: center;
    color: #fff;
}

.login-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.8rem;
}

.login-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.login-header p {
    font-size: 0.85rem;
    opacity: 0.8;
    margin: 0;
}

.login-body {
    padding: 2rem;
}

.login-body .form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}

.login-body .input-group-text {
    background: #f9fafb;
    border-right: none;
    color: #6b7280;
}

.login-body .form-control {
    border-left: none;
}

.login-body .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.2);
}

.login-body .input-group:focus-within .input-group-text {
    border-color: #667eea;
}

.login-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 600;
    padding: 0.65rem;
    border: none;
    border-radius: 8px;
    transition: opacity 0.2s, transform 0.1s;
}

.login-btn:hover {
    color: #fff;
    opacity: 0.9;
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
    color: #9ca3af;
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.login-google {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.login-dev-btn {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: #9ca3af;
    text-decoration: none;
    margin-top: 0.5rem;
}

.login-dev-btn:hover {
    color: #667eea;
}

.login-error {
    display: block;
    text-align: center;
    color: #dc3545;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

/* ---- Account Avatar ---- */
.account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.account-avatar:hover {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.5);
}

/* ---- Page Banner ---- */
.page-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    padding: 50px 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 3rem;
}

.banner-content h1 {
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ---- Hero Banner (Dashboard) ---- */
.hero-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ---- Stat Cards (Dashboard) ---- */
.stat-card {
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    color: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

/* 觸控裝置沒有「移開」這個動作，:hover 會在點完之後一直留著，
   浮起與陰影就卡在那裡不會還原，所以這類效果只給真的能 hover 的裝置 */
@media (hover: hover) {
    .stat-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    }
}

.stat-card-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card-success {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card-warning {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card-info {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stat-content {
    flex-grow: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* ---- Content Card (Dashboard) ---- */
.content-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: none;
}

@media (hover: hover) {
    .content-card:hover {
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
        transform: translateY(-2px);
    }
}

.card-header-custom {
    padding: 20px;
    color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-header-custom i {
    font-size: 1.25rem;
}

/* ---- Search Card ---- */
.search-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #667eea;
    margin-bottom: 1.5rem;
}

/* ---- Table Card ---- */
.table-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.table-card table {
    margin-bottom: 0;
}

.table-card thead {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.table-card thead th {
    font-weight: 600;
    color: #495057;
    padding: 16px 12px;
    font-size: 20px;
}

.table-card tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #dee2e6;
}

.table-card tbody tr:hover {
    background-color: #f8f9fa;
    box-shadow: inset 4px 0 0 #667eea;
}

.table-card tbody td {
    padding: 16px 12px;
    font-size: 22px;
}

/* ---- Card Container (Detail Pages) ---- */
.card-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border-top: 4px solid #667eea;
}

.card-container .card-body {
    padding: 32px;
}

/* ---- Button Group (Detail Pages) ---- */
.button-group {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #dee2e6;
}

/* ---- Form Controls ---- */
.form-control,
.form-select {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* ---- Buttons ---- */
.btn {
    transition: all 0.2s ease;
    border-radius: 8px;
    font-weight: 500;
}

@media (hover: hover) {
    .btn:not(.disabled):hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3d8f 100%);
}

/* ---- Tab Navigation ---- */
.nav-tabs .nav-link {
    color: #6c757d;
    border: none;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    padding: 12px 20px;
}

.nav-tabs .nav-link:hover {
    color: #667eea;
    border-bottom-color: #667eea;
}

.nav-tabs .nav-link.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background-color: transparent;
}

/* ---- Badge ---- */
.badge {
    padding: 8px 12px;
    font-size: 0.85rem;
}

/* ---- Modal Header ---- */
.modal-header.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
    display: block;
}

.empty-state p {
    margin: 0;
}

/* ---- Gradient Backgrounds ---- */
.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

/* ---- List Items (Dashboard) ---- */
.news-item,
.ticket-item {
    transition: background-color 0.2s ease;
    border-left: 4px solid transparent;
}

.news-item:hover {
    background-color: #f8f9fa;
    border-left-color: #667eea;
}

.ticket-item:hover {
    background-color: #f8f9fa;
    border-left-color: #f5576c;
}

/* ---- Preview Card (Emoji Detail) ---- */
.preview-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.preview-card:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-color: #667eea;
}

.preview-content {
    font-size: 4rem;
    color: #667eea;
    line-height: 1;
}

/* ---- Credential Card (帳號密碼) ---- */
.credential-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #667eea;
    padding: 18px 20px;
    height: 100%;
    transition: all 0.2s ease;
}

@media (hover: hover) {
    .credential-card:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        transform: translateY(-2px);
    }
}

.credential-card .credential-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: #343a40;
    margin-bottom: 14px;
    word-break: break-word;
}

.credential-card .credential-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #adb5bd;
    margin-bottom: 2px;
}

/* 帳號與密碼可能很長，讓它自己換行而不是把卡片撐開 */
.credential-card .credential-value {
    font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
    font-size: 0.9rem;
    color: #495057;
    word-break: break-all;
    min-width: 0;
}

.credential-card .credential-value.is-masked {
    letter-spacing: 0.15em;
    color: #adb5bd;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .page-banner,
    .hero-banner {
        padding: 30px 20px;
    }

    .banner-content h1,
    .hero-content h1 {
        font-size: 1.75rem;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .stat-icon {
        margin-bottom: 0.5rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .card-container .card-body {
        padding: 20px;
    }

    .button-group {
        flex-wrap: wrap;
    }
}

/* ---- Navigation Bar Responsive Design ---- */
.navbar-nav {
    gap: 0.25rem;
}

.navbar-nav .nav-link {
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

/* 大屏幕 (≥992px) */
@media (min-width: 992px) {
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
    }
}

/* 平板屏幕 (768px ~ 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .navbar-nav .nav-link {
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0.5rem 0.5rem;
    }

    .nav-link i {
        margin-right: 0.3rem;
    }
}

/* 小屏幕 (<768px) 時使用漢堡菜單 */
@media (max-width: 767px) {
    .navbar-nav .nav-link {
        padding: 0.5rem 0;
        font-size: 1rem;
    }
}

/* 下拉菜單調整 */
.dropdown-menu {
    min-width: auto;
    padding: 0.5rem 0;
}

.dropdown-item {
    white-space: nowrap;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
}

/* ---- Anchor Section (浮動錨點選單的目標) ----
   捲過去時上方要留一段空白，否則區塊標題會被 MainLayout 那條
   sticky 的 top-row（3.5rem）壓在底下。
   top-row 在 641px 以下不是 sticky，所以窄螢幕只要留一點呼吸空間 */
.anchor-section {
    scroll-margin-top: 1rem;
}

@media (min-width: 641px) {
    .anchor-section {
        scroll-margin-top: 4.5rem;
    }
}
