/**
 * 樟樹區人員名單系統 - 自定義樣式
 * 創建日期: 2025/6/10
 */

/* 全域樣式 */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* 字體設定 */
body {
    font-family: 'Microsoft JhengHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
}

/* 標題樣式 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--dark-color);
}

/* 卡片樣式 */
.card {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid rgba(0, 0, 0, 0.125);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--light-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* 按鈕樣式 */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.5rem 1rem;
    font-size: 1.125rem;
}

/* 表格樣式 */
.table {
    margin-bottom: 0;
}

.table th {
    background-color: var(--light-color);
    border-top: none;
    font-weight: 600;
    color: var(--dark-color);
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.025);
}

/* 表單樣式 */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.required::after {
    content: ' *';
    color: var(--danger-color);
}

/* 人員照片樣式 */
.person-photo {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: var(--box-shadow);
}

.person-photo-small {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: var(--box-shadow);
}

.person-photo-large {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: var(--border-radius);
    border: 3px solid #fff;
    box-shadow: var(--box-shadow);
}

.person-photo-medium {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--border-radius);
    border: 2px solid #fff;
    box-shadow: var(--box-shadow);
}

/* 預設頭像 */
.default-avatar {
    background-color: var(--light-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    font-size: 4rem;
    border-radius: 50%;
}

/* 側邊欄樣式 */
.sidebar {
    min-height: calc(100vh - 56px);
    background-color: #fff;
    border-right: 1px solid #dee2e6;
    padding: 0;
}

.sidebar .nav {
    flex-direction: column;
}

.sidebar .nav-link {
    color: var(--dark-color);
    padding: 0.75rem 1rem;
    border-radius: 0;
    border-bottom: 1px solid #f8f9fa;
    transition: all 0.15s ease-in-out;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

/* 主要內容區域 */
.main-content {
    padding: 2rem;
    min-height: calc(100vh - 56px);
}

/* 頁面標頭 */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.page-header h1 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.page-header .lead {
    color: var(--secondary-color);
    margin-bottom: 0;
}

/* 統計卡片 */
.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
}

.stats-card .card-body {
    padding: 1.5rem;
}

.stats-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stats-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* 樹狀圖容器 */
.tree-container {
    height: 600px;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    background-color: #fff;
    position: relative;
    overflow: hidden;
}

.tree-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.tree-controls .btn {
    margin-left: 0.25rem;
}

/* 上傳區域 */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 3rem;
    text-align: center;
    background-color: var(--light-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
}

.upload-area i {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.upload-area h5 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.upload-area p {
    color: var(--secondary-color);
    margin-bottom: 0;
}

/* 載入動畫 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: var(--secondary-color);
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* 警告訊息 */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--box-shadow);
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
}

.alert-info {
    background-color: #d1ecf1;
    color: #055160;
}

/* 分頁樣式 */
.pagination {
    margin-bottom: 0;
}

.page-link {
    color: var(--primary-color);
    border-radius: var(--border-radius);
    margin: 0 0.125rem;
}

.page-link:hover {
    color: var(--primary-color);
    background-color: var(--light-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 搜尋框 */
.search-box {
    position: relative;
}

.search-box .form-control {
    padding-right: 2.5rem;
}

.search-box .search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
    pointer-events: none;
}

/* 關係標籤 */
.relationship-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
}

.relationship-family {
    background-color: #e7f3ff;
    color: #0066cc;
}

.relationship-shepherding {
    background-color: #e8f5e8;
    color: #2d5a2d;
}

.relationship-morning {
    background-color: #fff3e0;
    color: #cc6600;
}

/* 人員卡片 */
.person-card {
    transition: transform 0.2s ease-in-out;
    cursor: pointer;
}

.person-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.person-card .card-body {
    padding: 1rem;
}

.person-card .person-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.person-card .person-info {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 0;
}

/* 導航欄響應式修正 */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.navbar-nav .dropdown-menu {
    border-radius: var(--border-radius);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: none;
}

.navbar-nav .dropdown-item {
    padding: 0.5rem 1rem;
    transition: all 0.15s ease-in-out;
}

.navbar-nav .dropdown-item:hover {
    background-color: var(--primary-color);
    color: white;
}

.navbar-nav .dropdown-item i {
    width: 20px;
    text-align: center;
}

/* 響應式設計 */
@media (max-width: 991.98px) {
    /* 大平板以下 */
    .navbar-nav .dropdown-menu {
        background-color: transparent;
        border: none;
        box-shadow: none;
        padding-left: 1rem;
    }
    
    .navbar-nav .dropdown-item {
        color: rgba(0,0,0,.55);
        padding: 0.25rem 1rem;
    }
    
    .navbar-nav .dropdown-item:hover {
        background-color: rgba(0,0,0,.04);
        color: rgba(0,0,0,.55);
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .page-header {
        margin-bottom: 1rem;
    }
    
    .person-photo-large {
        width: 120px;
        height: 120px;
    }
    
    .person-photo,
    .person-photo-small {
        width: 120px;
        height: 120px;
    }
    
    .default-avatar {
        font-size: 3rem;
    }
    
    .stats-number {
        font-size: 2rem;
    }
    
    .tree-container {
        height: 400px;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-area i {
        font-size: 2rem;
    }
    
    .sidebar {
        min-height: auto;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 0.25rem;
    }
    
    .tree-container {
        height: 300px;
    }
    
    .person-photo,
    .person-photo-small,
    .person-photo-large {
        width: 100px;
        height: 100px;
    }
    
    .default-avatar {
        font-size: 2.5rem;
    }
}

/* 列印樣式 */
@media print {
    .navbar,
    .sidebar,
    .btn,
    .pagination,
    .tree-controls {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .table {
        font-size: 12px;
    }
    
    .page-header {
        border-bottom: 2px solid #000;
    }
}

/* 動畫效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-in-out;
}

/* 工具提示樣式 */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    background-color: var(--dark-color);
    border-radius: var(--border-radius);
}

/* 彈出提示樣式 */
.popover {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.popover-header {
    background-color: var(--light-color);
    border-bottom: 1px solid #dee2e6;
}

/* 自定義滾動條 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-color);
}