/**
 * 樣式表
 * Hospital Phone Directory System Stylesheet
 */

/* 重置和基本樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 標題樣式 */
h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.2em;
    font-weight: bold;
}

/* 標題連結樣式 */
h1 a {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
}

h1 a:hover {
    color: #007cba;
    text-decoration: none;
}

h2 {
    color: #34495e;
    margin-bottom: 20px;
    font-size: 1.5em;
}

/* 搜尋區域 */
.search-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    position: relative;
}

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

.search-input {
    flex: 1;
    min-width: 300px;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 5px;
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: #3498db;
}

.search-btn {
    padding: 12px 25px;
    font-size: 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

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

/* 搜尋建議 */
.suggestions {
    position: absolute;
    top: 100%;
    left: 30px;
    right: 30px;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.suggestion-item:hover,
.suggestion-item.suggestion-active {
    background-color: #f8f9fa;
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* 結果區域 */
.results-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 表格樣式 */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

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

.results-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
    position: sticky;
    top: 0;
}

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

.results-table td {
    vertical-align: top;
}

/* 無結果提示 */
.no-results {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
    font-size: 18px;
}

/* 管理後台樣式 */
.admin-header {
    background-color: #2c3e50;
    color: white;
    padding: 15px 0;
    margin-bottom: 30px;
}

.admin-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.admin-nav a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.admin-nav a:hover,
.admin-nav a.active {
    background-color: #34495e;
}

/* 表單樣式 */
.form-group {
    margin-bottom: 20px;
}

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

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

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

/* 按鈕樣式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

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

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

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

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

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

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

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

/* 訊息提示 */
.message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    font-weight: bold;
}

.message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-input {
        min-width: 100%;
    }
    
    .results-table {
        font-size: 14px;
    }
    
    .results-table th,
    .results-table td {
        padding: 8px;
    }
    
    .admin-nav {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }
    
    .search-section,
    .results-section {
        padding: 15px;
    }
    
    .results-table {
        font-size: 12px;
    }
    
    .results-table th,
    .results-table td {
        padding: 6px;
    }
}

/* 載入動畫 */
.loading {
    text-align: center;
    padding: 20px;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 分頁樣式 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 5px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid #ddd;
    color: #3498db;
    border-radius: 3px;
}

.pagination a:hover {
    background-color: #f5f5f5;
}

.pagination .current {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* 統計資訊 */
.stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #3498db;
}

.stat-label {
    color: #7f8c8d;
    margin-top: 5px;
}