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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 50px auto;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
}

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

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

small {
    color: #999;
    font-size: 13px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
    width: auto;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    margin-left: 8px;
    width: auto;
}

.message {
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.footer {
    text-align: center;
    color: white;
    margin-top: 30px;
    opacity: 0.9;
}

/* 管理員後臺樣式 */
.admin-header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.admin-header h1 {
    margin: 0;
}

.admin-header .btn {
    width: auto;
}

.admin-content {
    display: grid;
    gap: 20px;
}

.team-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.team-header h3 {
    margin: 0;
    color: #333;
}

.badge {
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.team-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.team-info p {
    margin: 8px 0;
    color: #555;
}

code {
    background: #f4f4f4;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #e83e8c;
}

.keys-section {
    margin: 20px 0;
}

.keys-section h4 {
    margin-bottom: 12px;
    color: #555;
}

.key-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
}

.key-item.used {
    background: #e9ecef;
    opacity: 0.7;
}

.key-number {
    font-weight: 600;
    color: #667eea;
    margin-right: 10px;
    min-width: 30px;
}

.key-code {
    flex: 1;
    font-size: 12px;
    word-break: break-all;
}

.key-status {
    color: #28a745;
    font-size: 13px;
    margin-left: 10px;
}

.team-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.team-actions .btn {
    width: auto;
    flex: 1;
}

.invitations-table {
    width: 100%;
    border-collapse: collapse;
}

.invitations-table th,
.invitations-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.invitations-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.status-success {
    color: #28a745;
}

.status-failed {
    color: #dc3545;
}

.empty {
    text-align: center;
    color: #999;
    padding: 40px;
}

@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .admin-header .btn {
        width: 100%;
    }
    
    .team-actions {
        flex-direction: column;
    }
}

/* 自動踢人配置樣式 */
.status-success {
    color: #10b981;
    font-weight: 500;
}

.status-failed {
    color: #ef4444;
    font-weight: 500;
}

input[type="time"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 8px;
}

/* 彈窗樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

/* Teams 網格佈局 */
.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.team-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    background: #fff;
    transition: all 0.3s;
}

.team-card:hover {
    border-color: #667eea;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.2);
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.team-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.team-info {
    margin-bottom: 15px;
}

.team-info p {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
}

.team-info code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #e83e8c;
}

.team-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 徽章樣式 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #e0e0e0;
    color: #666;
}

.badge-owner {
    background: #ffd700;
    color: #333;
}

.badge-temp {
    background: #ff9800;
    color: white;
}

.badge-success {
    background: #10b981;
    color: white;
}

.badge-error {
    background: #ef4444;
    color: white;
}

/* 成員列表 */
.members-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    gap: 15px;
}

.member-info {
    flex: 1;
}

.member-info strong {
    font-size: 15px;
    color: #333;
}

.member-info .badge {
    margin-left: 10px;
}

.member-meta {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

.member-meta small {
    color: #999;
    font-size: 12px;
}

/* 邀請碼列表 */
.keys-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.key-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    gap: 15px;
}

.key-info {
    flex: 1;
}

.key-code {
    background: #f0f0f0;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #e83e8c;
    border: 1px solid #e0e0e0;
    display: inline-block;
}

.key-meta {
    margin-top: 8px;
}

.key-meta small {
    color: #999;
    font-size: 12px;
}

/* 日誌表格 */
.log-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.log-table th,
.log-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.log-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.log-table td {
    font-size: 13px;
    color: #666;
}

.log-table tr:hover {
    background: #f9f9f9;
}

/* 響應式 */
@media (max-width: 768px) {
    .teams-grid {
        grid-template-columns: 1fr;
    }

    .team-actions {
        flex-direction: column;
    }

    .team-actions .btn {
        width: 100%;
    }

    .member-item,
    .key-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}
