* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0e1117;
    --surface-dark: #1a1d24;
    --border-dark: #2d3139;
    --text-primary: #ffffff;
    --text-secondary: #8b92a4;
    --primary-color: #00c7b7;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

/* 畫面切換 */
.screen {
    display: none;
}

.screen.active {
    display: flex !important;
}

/* ==================== 登入畫面 ==================== */
#loginScreen,
#emailScreen,
#tokenScreen {
    min-height: 100vh;
    display: flex !important;
    justify-content: center;
    align-items: center;
    background: var(--bg-dark);
}

#loginScreen:not(.active),
#emailScreen:not(.active),
#tokenScreen:not(.active) {
    display: none !important;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header h1 {
    color: var(--text-primary);
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 10px;
}

.last-used {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 登入按鈕 */
.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.login-btn {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    background: var(--surface-dark);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.login-btn:hover {
    background: #22252d;
    border-color: #3d4149;
}

.google-btn:hover {
    background: #4285F4;
    border-color: #4285F4;
}

.github-btn:hover {
    background: #24292e;
    border-color: #24292e;
}

.gitlab-btn:hover {
    background: #fc6d26;
    border-color: #fc6d26;
}

.bitbucket-btn:hover {
    background: #0052cc;
    border-color: #0052cc;
}

/* Email 登入按鈕 */
.login-divider {
    margin: 20px 0;
    text-align: center;
}

.email-login-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px;
    transition: opacity 0.2s ease;
}

.email-login-btn:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* 註冊連結 */
.signup-link {
    text-align: center;
    margin-top: 30px;
    color: var(--text-secondary);
    font-size: 14px;
}

.signup-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.signup-link a:hover {
    text-decoration: underline;
}

/* Email 表單 */
.email-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    background: var(--surface-dark);
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #22252d;
}

.form-group small {
    color: var(--text-secondary);
    font-size: 12px;
}

.help-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

.submit-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 6px;
    background: var(--primary-color);
    color: #000;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-btn:hover {
    background: #00b3a5;
}

.error-message {
    color: var(--danger-color);
    font-size: 14px;
    text-align: center;
    display: none;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
}

.error-message.show {
    display: block;
}

/* 返回連結 */
.back-link {
    margin-top: 30px;
    text-align: center;
}

.back-link button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s ease;
}

.back-link button:hover {
    color: var(--text-primary);
}

/* ==================== 主畫面 ==================== */
#mainScreen {
    display: block;
}

.header {
    background: var(--surface-dark);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header h1 {
    font-size: 1.5em;
    color: var(--text-primary);
}

.user-info {
    color: var(--text-secondary);
    font-size: 14px;
}

.main-container {
    display: flex;
    height: calc(100vh - 80px);
}

/* ==================== 側邊欄 ==================== */
.sidebar {
    width: 300px;
    background: var(--surface-dark);
    border-right: 1px solid var(--border-dark);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-dark);
}

.sidebar-header h2 {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.project-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.project-item {
    padding: 15px;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.project-item:hover {
    background: #22252d;
}

.project-item.active {
    background: rgba(0, 199, 183, 0.1);
    border-color: var(--primary-color);
}

.project-item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.project-item-info {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==================== 內容區 ==================== */
.content {
    flex: 1;
    background: var(--bg-dark);
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.project-content {
    padding: 30px;
}

.content-header {
    background: var(--surface-dark);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border-dark);
}

.project-info {
    margin-bottom: 15px;
}

.project-info h2 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.project-url {
    display: flex;
    align-items: center;
    gap: 10px;
}

.url-display {
    background: var(--bg-dark);
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: var(--primary-color);
    border: 1px solid var(--border-dark);
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==================== 按鈕 ==================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary-color);
    color: #000;
}

.btn-primary:hover {
    background: #00b3a5;
}

.btn-secondary {
    background: var(--surface-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-dark);
}

.btn-secondary:hover {
    background: #22252d;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    transition: transform 0.2s ease;
}

.btn-icon:hover {
    transform: scale(1.2);
}

/* ==================== 檔案列表 ==================== */
.file-list-container {
    background: var(--surface-dark);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-dark);
}

.file-table {
    width: 100%;
    border-collapse: collapse;
}

.file-table thead {
    background: #22252d;
}

.file-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-dark);
}

.file-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-dark);
    color: var(--text-primary);
}

.file-table tbody tr:hover {
    background: #22252d;
}

.file-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.file-icon {
    font-size: 20px;
}

.file-actions {
    display: flex;
    gap: 8px;
}

.file-actions button {
    padding: 6px 12px;
    font-size: 12px;
}

/* ==================== 對話框 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface-dark);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-dark);
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 1.3em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-dark);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ==================== 上傳區域 ==================== */
.upload-area {
    border: 2px dashed var(--border-dark);
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(0, 199, 183, 0.05);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.upload-list {
    margin-top: 20px;
}

.upload-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--bg-dark);
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--border-dark);
}

/* ==================== Toast 提示 ==================== */
.deployment-status {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--surface-dark);
    padding: 15px 25px;
    border-radius: 8px;
    border: 1px solid var(--border-dark);
    z-index: 1000;
    box-shadow: var(--shadow);
}

.status-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

/* ==================== 響應式 ====================*/
/* 狀態標籤 */
.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success {
    background: #10b981;
    color: white;
}

/* 網址輸入框 */
.url-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #2d3748;
    color: #a0aec0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    transition: all 0.2s;
}

.url-input:focus {
    border-color: #00c7b7;
    color: #fff;
    background: rgba(0, 0, 0, 0.4);
    outline: none;
}

/* 按鈕群組 */
.file-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 200px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
}