/**
 * 資訊整理系統 - 樣式表
 */

:root {
    --theme-color: #1a1a2e;
    --theme-light: #252542;
    --theme-dark: #0f0f1a;
    --text-primary: #2c3e50;
    --text-secondary: #555;
    --gold-color: #ffd700;
    --border-color: #4a4a5a;
    --bg-light: #f8f9fa;
}

/* 基本設定 */
body {
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    color: var(--text-primary);
    background-color: #f4f6f9;
    min-height: 100vh;
}

/* 登入頁面 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--theme-color) 0%, var(--theme-dark) 100%);
}

.login-box {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    color: var(--theme-color);
    margin-bottom: 2rem;
    font-weight: 700;
    text-align: center;
}

.login-box .form-control {
    height: 50px;
    font-size: 1.1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}

.login-box .form-control:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.1);
}

.login-box .btn-primary {
    height: 50px;
    font-size: 1.1rem;
    background: var(--theme-color);
    border: none;
    border-radius: 8px;
    font-weight: 600;
}

.login-box .btn-primary:hover {
    background: var(--theme-light);
}

/* 頂部配色調整區 */
.theme-bar {
    background: var(--theme-color);
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.theme-bar .theme-title {
    color: white;
    font-weight: 600;
    margin-right: 20px;
    font-size: 0.9rem;
}

.theme-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all 0.2s;
    margin: 0 5px;
}

.theme-btn:hover {
    transform: scale(1.15);
    border-color: white;
}

.theme-btn.active {
    border-color: var(--gold-color);
    box-shadow: 0 0 10px var(--gold-color);
}

.theme-btn-black { background: #1a1a1a; }
.theme-btn-gray { background: #37474f; }
.theme-btn-green { background: #2e7d32; }
.theme-btn-blue { background: #1a1a2e; }
.theme-btn-orange { background: #d84315; }

.color-picker-wrapper {
    display: inline-flex;
    align-items: center;
    margin-left: 15px;
}

.color-picker-wrapper label {
    color: white;
    font-size: 0.85rem;
    margin-right: 8px;
}

#customColorPicker {
    width: 40px;
    height: 32px;
    padding: 0;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

#customColorPicker::-webkit-color-swatch-wrapper {
    padding: 2px;
}

#customColorPicker::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

/* 主內容區 */
.main-header {
    background: var(--theme-color);
    color: white;
    padding: 2rem;
    text-align: center;
}

.main-header h1 {
    font-weight: 700;
    margin: 0;
    font-size: 2rem;
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 搜尋區 */
.search-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 25px;
}

.search-section .form-control {
    height: 45px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.search-section .form-control:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.1);
}

.search-section .btn-search {
    height: 45px;
    background: var(--theme-color);
    border: none;
    color: white;
    padding: 0 25px;
    border-radius: 8px;
    font-weight: 600;
}

.search-section .btn-search:hover {
    background: var(--theme-light);
}

.category-buttons {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.category-buttons .btn {
    margin: 3px;
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 0.9rem;
}

.category-buttons .btn-outline-secondary {
    border-color: #aaa;
    color: #555;
}

.category-buttons .btn-outline-secondary:hover,
.category-buttons .btn-outline-secondary.active {
    background: var(--theme-color);
    border-color: var(--theme-color);
    color: white;
}

/* 區域區塊 */
.area-block {
    margin-bottom: 35px;
}

.area-header {
    background: #e8e8e8;
    border: 3px solid #1a1a2e;
    border-left-width: 8px;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
}

.area-header h3 {
    margin: 0;
    font-weight: 700;
    color: #1a1a1a;
    font-size: 1.3rem;
}

.area-spacer {
    height: 15px;
    background: transparent;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.info-table thead th {
    background: #1a1a2e;
    color: #ffd700;
    padding: 14px 16px;
    font-weight: 600;
    text-align: left;
    border: 1px solid #4a4a5a;
}

.info-table tbody td {
    padding: 12px 16px;
    border: 1px solid #4a4a5a;
    vertical-align: middle;
}

.info-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.info-table tbody tr:hover {
    background: #f0f4f8;
}

.info-table .title-link {
    color: var(--theme-color);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.info-table .title-link:hover {
    color: var(--theme-light);
    text-decoration: underline;
}

/* 燈箱 Modal */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    background: var(--theme-color);
    color: white;
    border-radius: 16px 16px 0 0;
    padding: 1.2rem 1.5rem;
}

.modal-header .modal-title {
    font-weight: 700;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-body .content-display {
    line-height: 1.8;
    color: var(--text-primary);
}

.modal-body .content-display img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
}

.modal-body .info-meta {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    color: #666;
    font-size: 0.9rem;
}

/* 管理員區域 */
.admin-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 3px dashed #ccc;
}

.admin-section h4 {
    color: var(--theme-color);
    font-weight: 700;
    margin-bottom: 20px;
}

.admin-login-box {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    max-width: 400px;
}

.admin-panel {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.admin-panel .nav-tabs {
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

.admin-panel .nav-tabs .nav-link {
    border: none;
    color: #666;
    font-weight: 500;
    padding: 12px 20px;
}

.admin-panel .nav-tabs .nav-link.active {
    color: var(--theme-color);
    border-bottom: 3px solid var(--theme-color);
    background: none;
}

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

.admin-table th {
    background: #f5f5f5;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #ddd;
    font-weight: 600;
}

.admin-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.admin-table tr:hover {
    background: #fafafa;
}

.btn-action {
    padding: 5px 12px;
    font-size: 0.85rem;
    border-radius: 5px;
    margin: 0 2px;
}

/* 表單樣式 */
.form-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.form-section h5 {
    color: var(--theme-color);
    margin-bottom: 15px;
    font-weight: 600;
}

.form-label {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.form-control, .form-select {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.1);
}

/* TinyMCE 容器 */
.tox-tinymce {
    border-radius: 8px !important;
    border: 2px solid #e0e0e0 !important;
}

/* 按鈕樣式 */
.btn-primary {
    background: var(--theme-color);
    border: none;
}

.btn-primary:hover {
    background: var(--theme-light);
}

.btn-success {
    background: #28a745;
    border: none;
}

.btn-danger {
    background: #dc3545;
    border: none;
}

.btn-secondary {
    background: #6c757d;
    border: none;
}

/* 載入動畫 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .theme-bar {
        flex-wrap: wrap;
        padding: 10px;
    }
    
    .theme-bar .theme-title {
        width: 100%;
        margin-bottom: 10px;
        text-align: center;
    }
    
    .color-picker-wrapper {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .main-header h1 {
        font-size: 1.5rem;
    }
    
    .content-wrapper {
        padding: 15px;
    }
    
    .info-table {
        font-size: 0.9rem;
    }
    
    .info-table thead th,
    .info-table tbody td {
        padding: 10px 8px;
    }
}

/* 無資料提示 */
.no-data {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1rem;
}

.no-data i {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

/* 匯出按鈕 */
.export-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* 滾動條美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}
