/* ===========================
   Team Management Page Styles
   團隊管理頁面專用樣式
   =========================== */

/* CSS Variables - 複用主題色 */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-hover: #1f2b47;
    --accent-primary: #e94560;
    --accent-secondary: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --text-muted: #6b6b6b;
    --border-color: rgba(255, 255, 255, 0.1);
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #ef4444;
    --info: #3b82f6;

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* 🌊 海洋主題 */
[data-theme="ocean"] {
    --bg-primary: #0a192f;
    --bg-secondary: #112240;
    --bg-card: #1d3557;
    --bg-card-hover: #264673;
    --accent-primary: #64ffda;
    --accent-secondary: #457b9d;
    --text-primary: #e6f1ff;
    --text-secondary: #8892b0;
}

/* 🌲 森林主題 */
[data-theme="forest"] {
    --bg-primary: #1a1f16;
    --bg-secondary: #2d3a24;
    --bg-card: #3d4f35;
    --bg-card-hover: #4a6040;
    --accent-primary: #90be6d;
    --accent-secondary: #577546;
    --text-primary: #f0f4e8;
    --text-secondary: #b8c4a8;
}

/* 🌅 日落主題 */
[data-theme="sunset"] {
    --bg-primary: #1a0a14;
    --bg-secondary: #2d1525;
    --bg-card: #4a2040;
    --bg-card-hover: #5c2850;
    --accent-primary: #ff7b54;
    --accent-secondary: #ff3c78;
    --text-primary: #fff0e8;
    --text-secondary: #d4a8b8;
}

/* 💜 薰衣草主題 */
[data-theme="lavender"] {
    --bg-primary: #1a1625;
    --bg-secondary: #2a2438;
    --bg-card: #3d3455;
    --bg-card-hover: #4d4268;
    --accent-primary: #b388ff;
    --accent-secondary: #7c4dff;
    --text-primary: #f5f0ff;
    --text-secondary: #b8a8d4;
}

/* 🍬 糖果主題 */
[data-theme="candy"] {
    --bg-primary: #fef6f9;
    --bg-secondary: #fff0f5;
    --bg-card: #ffe4ec;
    --bg-card-hover: #ffd6e3;
    --accent-primary: #ff6b9d;
    --accent-secondary: #c44569;
    --text-primary: #4a2040;
    --text-secondary: #8b5e72;
    --text-muted: #b88a9a;
    --border-color: rgba(0, 0, 0, 0.1);
}

/* Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.team-container {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    min-height: 100vh;
}

/* Header */
.team-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.team-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: var(--accent-primary);
}

/* Cards */
.team-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.card-icon {
    font-size: 1.2rem;
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: var(--spacing-lg);
}

/* Current Team Card */
.current-team {
    border: 2px solid var(--accent-primary);
}

.team-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-value {
    font-weight: 500;
}

.info-value.code {
    font-family: 'Monaco', 'Consolas', monospace;
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.info-value.status {
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.8rem;
}

.info-value.status.online {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
}

.info-value.status.offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.info-value.status.local {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.input-group {
    display: flex;
    gap: var(--spacing-sm);
}

.input-group input {
    flex: 1;
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: #d63d56;
}

.btn-success {
    background: var(--success);
    color: #1a1a2e;
}

.btn-success:hover {
    background: #3cc76f;
}

.full-width {
    width: 100%;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

.toast.info {
    background: var(--info);
    color: white;
}

.toast.success {
    background: var(--success);
    color: #1a1a2e;
}

.toast.error {
    background: var(--danger);
    color: white;
}

/* Team History List */
.team-history-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.team-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.team-history-item:hover {
    background: var(--bg-card-hover);
}

.team-history-item.active {
    border-color: var(--accent-primary);
    background: rgba(233, 69, 96, 0.1);
}

.team-history-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.team-history-name {
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-history-id {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'Monaco', 'Consolas', monospace;
}

.team-history-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.team-history-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.btn-switch {
    padding: 4px 12px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-switch:hover {
    background: #d63d56;
}

.btn-remove {
    width: 24px;
    height: 24px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    background: var(--danger);
    color: white;
}

.current-badge {
    padding: 4px 12px;
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
}

/* ==================== 管理員區塊樣式 ==================== */

.admin-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
}

.admin-badge {
    background: linear-gradient(135deg, var(--warning), #f59e0b);
    color: #000;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
}

.admin-team-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.admin-team-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.admin-team-item:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--accent-primary);
}

.admin-team-item.default {
    border-color: var(--warning);
    background: rgba(251, 191, 36, 0.1);
}

.admin-team-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.admin-team-name {
    font-weight: 600;
    color: var(--text-primary);
}

.admin-team-id {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.admin-team-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.admin-team-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.default-badge {
    background: var(--warning);
    color: #000;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
    border: none;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #f59e0b);
    color: #000;
    border: none;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

/* Responsive */
@media (max-width: 480px) {
    .team-container {
        padding: var(--spacing-md);
    }

    .team-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .team-header h1 {
        font-size: 1.3rem;
    }

    .card-body {
        padding: var(--spacing-md);
    }

    .input-group {
        flex-direction: column;
    }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
    }

    .admin-team-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .admin-team-actions {
        width: 100%;
        justify-content: flex-end;
    }
}