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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.loading-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-size: 24px;
    color: #666;
}

.hidden {
    display: none !important;
}

.auth-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

.auth-container input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.auth-container button {
    width: 100%;
    padding: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.auth-container button:hover {
    background-color: #2980b9;
}

.error-message {
    color: #e74c3c;
    margin-top: 10px;
    text-align: center;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid #3498db;
    margin-bottom: 30px;
}

header h1 {
    color: #2c3e50;
    font-size: 28px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info p {
    color: #666;
}

#logout-btn {
    padding: 8px 16px;
    background-color: #95a5a6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#logout-btn:hover {
    background-color: #7f8c8d;
}

section {
    background: white;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.primary-btn {
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.primary-btn:hover {
    background-color: #2980b9;
}

.secondary-btn {
    padding: 10px 20px;
    background-color: #95a5a6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.secondary-btn:hover {
    background-color: #7f8c8d;
}

.danger-btn {
    padding: 10px 20px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.danger-btn:hover {
    background-color: #c0392b;
}

.info-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
}

.info-message.success {
    background-color: #d4edda;
    color: #155724;
}

.info-message.error {
    background-color: #f8d7da;
    color: #721c24;
}

.info-message.warning {
    background-color: #fff3cd;
    color: #856404;
}

.check-section .form-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.check-section input {
    flex: 1;
    max-width: 200px;
}

#check-result-container {
    margin-top: 15px;
}

.list-section input {
    width: 100%;
    max-width: 300px;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

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

table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

table tr:hover {
    background-color: #f8f9fa;
}

.blacklist-yes {
    color: #e74c3c;
    font-weight: bold;
}

.blacklist-no {
    color: #27ae60;
}

.action-btns {
    display: flex;
    gap: 5px;
}

.action-btns button {
    padding: 5px 10px;
    font-size: 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.edit-btn {
    background-color: #f39c12;
    color: white;
}

.edit-btn:hover {
    background-color: #e67e22;
}

.blacklist-btn {
    background-color: #e74c3c;
    color: white;
}

.blacklist-btn:hover {
    background-color: #c0392b;
}

.unblacklist-btn {
    background-color: #27ae60;
    color: white;
}

.unblacklist-btn:hover {
    background-color: #229954;
}

.delete-btn {
    background-color: #95a5a6;
    color: white;
}

.delete-btn:hover {
    background-color: #7f8c8d;
}

@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    table {
        font-size: 11px;
    }
    
    table th,
    table td {
        padding: 8px 4px;
    }
    
    .check-section .form-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .check-section input {
        max-width: none;
    }
}

/* ============================================
   MPF Excel 上載區域樣式
   ============================================ */

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

.mpf-upload-section h2 {
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.upload-container {
    padding: 10px 0;
}

.upload-description {
    margin-bottom: 20px;
    font-size: 14px;
    opacity: 0.95;
}

.upload-form {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.file-input {
    padding: 10px 15px;
    background: white;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
}

.file-input:hover {
    border-color: white;
    background: #f8f9fa;
}

.upload-status {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.upload-status.hidden {
    display: none;
}

#mpf-status-message {
    margin: 0 0 10px 0;
    font-weight: 500;
}

#mpf-status-message.success {
    color: #d4edda;
    background: transparent;
}

#mpf-status-message.error {
    color: #f8d7da;
    background: transparent;
}

#mpf-status-message.warning {
    color: #fff3cd;
    background: transparent;
}

#mpf-status-message.info {
    color: white;
    background: transparent;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar.hidden {
    display: none;
}

.progress-fill {
    height: 100%;
    width: 50%;
    background: white;
    border-radius: 4px;
    animation: progress-animation 1.5s ease-in-out infinite;
}

@keyframes progress-animation {
    0% { width: 0%; margin-left: 0%; }
    50% { width: 50%; margin-left: 25%; }
    100% { width: 0%; margin-left: 100%; }
}

.upload-results {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    color: #333;
}

.upload-results.hidden {
    display: none;
}

.upload-results h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 18px;
}

.result-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 25px;
    background: #f8f9fa;
    border-radius: 8px;
    min-width: 100px;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #3498db;
}

#mpf-new-count {
    color: #27ae60;
}

#mpf-update-count {
    color: #f39c12;
}

#mpf-error-count {
    color: #e74c3c;
}

.error-details {
    margin-top: 20px;
    padding: 15px;
    background: #f8d7da;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
}

.error-details.hidden {
    display: none;
}

.error-details h4 {
    margin-bottom: 10px;
    color: #721c24;
}

.error-details ul {
    list-style: none;
    padding: 0;
}

.error-details li {
    padding: 5px 0;
    color: #721c24;
    font-size: 13px;
}

.error-details li:before {
    content: "⚠️ ";
    margin-right: 5px;
}

/* ============================================
   AI 除錯綠框
   ============================================ */

.ai-debug-console {
    position: fixed;
    bottom: 10px;
    left: 10px;
    width: 400px;
    max-width: 90vw;
    height: 200px;
    background-color: #0a0a0a;
    border: 2px solid #00ff00;
    border-radius: 8px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    box-shadow: 0 4px 12px rgba(0, 255, 0, 0.3);
}

.ai-debug-console.hidden {
    display: none;
}

.debug-header {
    background-color: #00ff00;
    color: #000;
    padding: 5px 10px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px 6px 0 0;
}

.debug-header button {
    background: #000;
    color: #00ff00;
    border: 1px solid #00ff00;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 10px;
    border-radius: 3px;
}

.debug-header button:hover {
    background: #00ff00;
    color: #000;
}

.debug-log {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    color: #00ff00;
}

.log-entry {
    margin-bottom: 3px;
    word-break: break-all;
    line-height: 1.4;
}

.log-entry:nth-child(odd) {
    background-color: rgba(0, 255, 0, 0.05);
}