/* 數據表格樣式 */

.datagrid-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.datagrid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 10px;
}

.datagrid-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.datagrid-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.datagrid-search {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.datagrid-search input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    width: 200px;
    transition: border-color 0.2s;
}

.datagrid-search input:focus {
    outline: none;
    border-color: #667eea;
}

.datagrid-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.datagrid-table {
    width: 100%;
    border-collapse: collapse;
    min-width: max-content;
}

.datagrid-table th,
.datagrid-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.datagrid-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.datagrid-table tr:hover {
    background: #f9fafb;
}

.datagrid-table td {
    font-size: 14px;
    color: #4b5563;
}

.datagrid-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 10px;
}

.datagrid-info {
    font-size: 13px;
    color: #6b7280;
}

.datagrid-pagination {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.datagrid-pagination button {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.datagrid-pagination button:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.datagrid-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.datagrid-pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 按鈕樣式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* 表單樣式 */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

/* 模態框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
}

/* 狀態標籤 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* 移動端適配 */
@media (max-width: 768px) {
    .datagrid-header {
        padding: 12px 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    
    .datagrid-title {
        font-size: 16px;
        white-space: nowrap;
    }
    
    .datagrid-toolbar {
        flex-wrap: nowrap;
    }
    
    .datagrid-search {
        flex-wrap: nowrap;
    }
    
    .datagrid-search input {
        width: 120px;
        min-width: 100px;
    }
    
    .datagrid-search input[type="date"] {
        width: 130px;
        min-width: 110px;
    }
    
    .datagrid-footer {
        padding: 12px 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    
    .datagrid-info {
        white-space: nowrap;
    }
    
    /* 分頁選擇器縮短 */
    .datagrid-info select {
        width: 60px;
        padding: 4px 6px;
        font-size: 13px;
    }
    
    .datagrid-pagination {
        flex-wrap: nowrap;
    }
    
    .datagrid-pagination button {
        padding: 8px 12px;
        font-size: 14px;
    }
}
