/* 全局樣式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 頭部樣式 */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.toolbar {
    display: flex;
    gap: 10px;
}

.btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

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

.btn-primary {
    background-color: #2ecc71;
}

.btn-primary:hover {
    background-color: #27ae60;
}

/* 主內容區域樣式 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 側邊欄樣式 */
.sidebar {
    width: 250px;
    background-color: #ecf0f1;
    padding: 15px;
    overflow-y: auto;
    border-right: 1px solid #ddd;
}

.sidebar-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ccc;
}

.thumbnails {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.thumbnail {
    border: 1px solid #ddd;
    padding: 5px;
    background-color: white;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

.thumbnail.active {
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.thumbnail:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.thumbnail .page-number {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 2px 5px;
    font-size: 0.8rem;
    border-radius: 3px;
}

/* 編輯器區域樣式 */
.editor {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    background-color: #f9f9f9;
}

.page-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 800px;
    justify-content: center;
}

.page-view {
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    position: relative;
    max-width: 100%;
    height: auto;
    overflow: hidden;
    border-radius: 5px;
}

.page-view img {
    width: 100%;
    height: auto;
    display: block;
}

.page-view canvas {
    width: 100%;
    height: auto;
    display: block;
}

/* 工具面板樣式 */
.tools-panel {
    width: 300px;
    background-color: #ecf0f1;
    padding: 15px;
    overflow-y: auto;
    border-left: 1px solid #ddd;
}

.panel-section {
    margin-bottom: 20px;
    background-color: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.panel-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    color: #2c3e50;
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #3498db;
    outline: none;
}

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

.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border: 2px solid #3498db;
}

/* 頁腳樣式 */
.footer {
    background-color: #2c3e50;
    color: white;
    padding: 10px 20px;
    text-align: center;
    font-size: 0.9rem;
}

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

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 80%;
    max-width: 600px;
    position: relative;
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close-modal:hover {
    color: #555;
}

.image-preview-container {
    margin: 20px 0;
    text-align: center;
}

.image-preview-container img {
    max-width: 100%;
    max-height: 400px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .tools-panel {
        width: 250px;
    }
}

@media (max-width: 992px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    .thumbnails {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .tools-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid #ddd;
    }
}

@media (max-width: 768px) {
    .thumbnails {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 15px;
    }
    
    .toolbar {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .thumbnails {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .page-controls {
        flex-wrap: wrap;
    }
    
    .page-controls button {
        flex: 1;
        min-width: 40%;
    }
}


/* 用戶管理相關樣式 */
.user-info {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

.user-info span {
    margin-right: 10px;
    font-weight: bold;
}

.user-info .btn {
    margin-left: 5px;
    padding: 5px 10px;
    font-size: 14px;
}

#btn-login {
    background-color: #0066cc;
    color: white;
}

#btn-logout {
    background-color: #cc0000;
    color: white;
}

#btn-admin {
    background-color: #00cc00;
    color: white;
}

/* 登錄和註冊頁面樣式 */
.login-container, .register-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.login-container h2, .register-container h2 {
    text-align: center;
    margin-bottom: 20px;
}

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

.login-form label, .register-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.login-form input, .register-form input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.login-form button, .register-form button {
    width: 100%;
    padding: 10px;
    background-color: #0066cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.login-form button:hover, .register-form button:hover {
    background-color: #0055aa;
}

.login-links, .register-links {
    text-align: center;
    margin-top: 15px;
}

.login-links a, .register-links a {
    color: #0066cc;
    text-decoration: none;
}

.login-links a:hover, .register-links a:hover {
    text-decoration: underline;
}

.error-message {
    color: #ff0000;
    margin-bottom: 15px;
    text-align: center;
}

.success-message {
    color: #00cc00;
    margin-bottom: 15px;
    text-align: center;
}

/* 管理員面板樣式 */
.admin-container {
    max-width: 1000px;
    margin: 50px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.admin-container h2 {
    text-align: center;
    margin-bottom: 20px;
}

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

.admin-header .back-link {
    color: #0066cc;
    text-decoration: none;
}

.admin-header .back-link:hover {
    text-decoration: underline;
}

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

.user-table th, .user-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.user-table th {
    background-color: #f2f2f2;
}

.user-table tr:hover {
    background-color: #f5f5f5;
}

.user-actions {
    display: flex;
    gap: 10px;
}

.user-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

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

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

.btn-role {
    background-color: #00cc00;
    color: white;
}

