/* StaffAI BD - 共享基礎樣式 (AIOTEK Brand) */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&family=Noto+Sans+TC:wght@400;500;600;700;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* AIOTEK Brand Colors */
    --primary: #91d7d9;
    --primary-dark: #6bb8ba;
    --primary-darker: #4a9ea0;
    --primary-light: #b5e5e6;
    --primary-subtle: rgba(145, 215, 217, 0.08);
    --accent: #91d7d9;

    /* Dark (用於 primary 元素上的對比文字) */
    --dark: #141414;
    --dark-secondary: #1a1a1a;
    --dark-muted: #333;

    /* Semantic Colors */
    --success: #10B981;
    --success-light: rgba(16, 185, 129, 0.12);
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.12);
    --error: #EF4444;
    --error-light: rgba(239, 68, 68, 0.12);

    /* Neutrals (Dark Theme) */
    --bg-page: #0a0a0a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-input: rgba(255, 255, 255, 0.04);
    --text-primary: #e5e5e5;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.35);
    --border: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.2);

    /* Effects (Dark Theme) */
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 20%);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 25%), 0 2px 4px -2px rgb(0 0 0 / 15%);
    --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 30%), 0 4px 10px -4px rgb(0 0 0 / 15%);
    --shadow-xl: 0 20px 40px -8px rgb(0 0 0 / 35%);
    --shadow-focus: 0 0 0 3px rgb(145 215 217 / 15%);
    --shadow-primary: 0 4px 14px rgb(145 215 217 / 15%);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Poppins', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-light);
}

/* Button Base */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    min-width: 120px;
}

.btn-primary {
    background: #fff;
    color: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.btn-primary:hover {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #0a0a0a;
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

/* ===== User Menu (auth) ===== */
.user-menu {
    position: relative;
}

.user-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
}

.user-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    padding: 14px;
    display: none;
}

.user-dropdown.show {
    display: block;
}

.user-info {
    margin-bottom: 12px;
}

.user-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-email {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.user-logout-btn {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: background var(--transition-fast);
}

.user-logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-login-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    background: #fff;
    color: #0a0a0a;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.user-login-btn:hover {
    background: #f0f0f0;
    color: #0a0a0a;
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* 表格水平捲動容器（手機版） */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
}

.table-scroll-wrapper table {
    margin: 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .btn { min-width: auto; }
}

@media (max-width: 480px) {
    .card { padding: 20px; }

    input[type="text"],
    input[type="email"],
    textarea,
    select {
        font-size: 16px; /* 防 iOS 自動放大 */
    }

    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

/* Form elements */
input[type="text"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: all var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
    background: rgba(255, 255, 255, 0.06);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

select option {
    background: #1a1a1a;
    color: var(--text-primary);
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.required {
    color: var(--error);
    font-weight: 700;
    margin-left: 2px;
}

.optional {
    font-weight: 400;
    color: var(--text-muted);
    text-transform: none;
}

.hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.badge-generating {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-ready {
    background: var(--success-light);
    color: var(--success);
}

.badge-error {
    background: var(--error-light);
    color: var(--error);
}

/* ===== Notification Bell ===== */
.notif-bell {
    position: relative;
    display: flex;
    align-items: center;
}

.notif-bell-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.notif-bell-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--radius-full);
    background: var(--error);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 340px;
    max-height: 420px;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.notif-read-all {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
}

.notif-read-all:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.notif-list {
    overflow-y: auto;
    flex: 1;
    max-height: 360px;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-item.read {
    opacity: 0.5;
}

.notif-icon {
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1.4;
}

.notif-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.notif-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.notif-time {
    font-size: 11px;
    color: var(--text-muted);
}

.notif-empty,
.notif-loading {
    padding: 32px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 480px) {
    .notif-dropdown {
        min-width: 0;
        width: calc(100vw - 32px);
        right: -8px;
    }
}
