/* 全局樣式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
}

/* 導航列樣式 - 確保始終在最上層 */
.navbar {
    z-index: 10000 !important;
    position: relative;
}

/* 下拉選單樣式 - 確保在視窗之上 */
.dropdown-menu {
    z-index: 10001 !important;
}

/* Bootstrap 導航列修正 */
.navbar-nav .dropdown-menu {
    z-index: 10001 !important;
    position: absolute;
}

/* 確保導航列容器也有正確的層級 */
.navbar-collapse {
    z-index: 10001 !important;
}

/* 登入頁面樣式 */
.login-form {
    max-width: 400px;
    margin: 100px auto;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* 主內容區域樣式 */
#content-area {
    min-height: calc(100vh - 60px);
    padding: 20px;
}

/* 視窗元件樣式 */
.window-component {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 20px;
    position: absolute;
    min-width: 300px;
    min-height: 200px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.window-component.active {
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    border-color: #007bff;
}

.window-component.minimized {
    height: 40px !important;
    min-height: 40px !important;
}

.window-component.minimized .window-content {
    display: none;
}

.window-component.maximized {
    position: fixed !important;
    top: 56px !important; /* 為導航列留出空間 */
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - 56px) !important; /* 減去導航列高度 */
    border-radius: 0;
    z-index: 9999;
}

.window-header {
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    height: 40px;
    box-sizing: border-box;
}

.window-component.active .window-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.window-title {
    font-weight: 500;
    font-size: 14px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.window-controls {
    display: flex;
    gap: 4px;
}

.window-controls .btn {
    padding: 2px 6px;
    font-size: 12px;
    line-height: 1;
    border-radius: 3px;
}

.window-component.active .window-controls .btn {
    border-color: rgba(255,255,255,0.3);
    color: white;
}

.window-component.active .window-controls .btn:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

.window-content {
    padding: 15px;
    overflow-y: auto;
    height: calc(100% - 40px);
    box-sizing: border-box;
}

.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: se-resize;
    background: linear-gradient(-45deg, transparent 40%, #ccc 40%, #ccc 60%, transparent 60%);
    opacity: 0.7;
}

.resize-handle:hover {
    opacity: 1;
}

/* 表格樣式 */
.table-container {
    overflow-x: auto;
}

/* 按鈕樣式 */
.btn-group {
    margin-bottom: 15px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .window-component {
        position: static !important;
        width: 100% !important;
        margin-bottom: 15px;
    }
}

/* 工具列樣式 */
.toolbar {
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 搜索框樣式 */
.search-box {
    max-width: 300px;
}

/* 卡片樣式 */
.card {
    margin-bottom: 20px;
}

/* 表單樣式 */
.form-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 提示訊息樣式 */
.alert {
    margin-bottom: 15px;
}

/* 載入動畫 */
.loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

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

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