/* 國小生 LeetCode 程式學習網站 - 自定義樣式 */

/* 基礎樣式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* 分類卡片懸停效果 */
.category-card {
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* 進度條動畫 */
.progress-bar {
    transition: width 0.5s ease-in-out;
}

/* 按鈕懸停效果 */
.btn-hover {
    transition: all 0.2s ease;
}

.btn-hover:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 載入動畫 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

/* 四欄位版面樣式 */
.panel-transition {
    transition: width 0.3s ease, min-width 0.3s ease;
}

/* 題庫樹狀結構樣式 */
.category-item {
    margin-bottom: 8px;
}

.category-content {
    border-left: 2px solid #e5e7eb;
    padding-left: 8px;
}

.problem-item {
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.problem-item:hover {
    border-left-color: #3b82f6;
    background-color: #eff6ff;
}

/* 面板收合狀態 */
.panel-collapsed {
    width: 40px !important;
    min-width: 40px !important;
}

.panel-collapsed .panel-content {
    display: none;
}

/* 收合狀態下的按鈕樣式 */
.panel-collapsed .flex.items-center.justify-between {
    padding: 8px 4px;
    justify-content: center;
}

.panel-collapsed button {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-collapsed button:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

/* 收合狀態下的垂直文字 */
.panel-collapsed::before {
    content: attr(data-title);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 12px;
    color: #6b7280;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* 程式編輯器面板特殊樣式 */
#codeEditorPanel {
    flex: 1;
    min-width: 400px;
}

/* 測試案例樣式調整 */
.test-case {
    transition: all 0.2s ease;
}

.test-case.test-passed {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.test-case.test-failed {
    border-color: #ef4444;
    background-color: #fef2f2;
}

/* 響應式設計 */
@media (max-width: 1024px) {
    .flex-1 {
        min-width: 300px;
    }

    #problemLibraryPanel,
    #problemDescPanel,
    #testResultPanel {
        width: 250px !important;
        min-width: 200px !important;
    }
}

@media (max-width: 768px) {
    .flex {
        flex-direction: column;
    }

    #problemLibraryPanel,
    #problemDescPanel,
    #codeEditorPanel,
    #testResultPanel {
        width: 100% !important;
        min-width: 100% !important;
        height: 300px;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 模態框動畫 */
.modal-enter {
    animation: modalEnter 0.3s ease-out;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 成功動畫 */
.success-icon {
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* 通知樣式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background-color: #f0fdf4;
    border-left: 4px solid #10b981;
    color: #065f46;
}

.notification.error {
    background-color: #fef2f2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.notification.warning {
    background-color: #fffbeb;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.notification.info {
    background-color: #eff6ff;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

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

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

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #374151 transparent transparent transparent;
}

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

/* 狀態指示器 */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.online {
    background-color: #10b981;
}

.status-indicator.offline {
    background-color: #ef4444;
}

.status-indicator.idle {
    background-color: #f59e0b;
}

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

.search-box input {
    padding-left: 40px;
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

/* 標籤樣式 */
.tag {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
    margin-right: 4px;
    margin-bottom: 4px;
}

.tag.primary {
    background-color: #dbeafe;
    color: #1e40af;
}

.tag.success {
    background-color: #d1fae5;
    color: #065f46;
}

.tag.warning {
    background-color: #fef3c7;
    color: #92400e;
}

.tag.error {
    background-color: #fecaca;
    color: #991b1b;
}

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

.pagination button {
    margin: 0 4px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background-color: #fff;
    color: #374151;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:hover {
    background-color: #f3f4f6;
}

.pagination button.active {
    background-color: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 卡片陰影層級 */
.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.shadow-xl {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

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

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .category-card {
        margin-bottom: 16px;
    }
    
    .flex-col-mobile {
        flex-direction: column;
    }
    
    .w-full-mobile {
        width: 100%;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    .dark-mode {
        background-color: #1f2937;
        color: #f9fafb;
    }
    
    .dark-mode .bg-white {
        background-color: #374151;
    }
    
    .dark-mode .text-gray-900 {
        color: #f9fafb;
    }
    
    .dark-mode .text-gray-600 {
        color: #d1d5db;
    }
    
    .dark-mode .border-gray-200 {
        border-color: #4b5563;
    }
}

/* 表格樣式增強 */
.table-hover tbody tr:hover {
    background-color: #f9fafb;
}

/* 拖拽樣式 */
.draggable {
    cursor: move;
}

/* Blockly 工具箱滾動條隱藏 - 全域樣式 */
.blocklyToolboxDiv .blocklyScrollbarVertical,
.blocklyToolboxDiv .blocklyScrollbarHorizontal,
.blocklyFlyoutScrollbar,
.blocklyScrollbarVertical.blocklyFlyoutScrollbar,
.blocklyScrollbarHorizontal.blocklyFlyoutScrollbar {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

/* 確保工具箱可以滾動但隱藏滾動條 */
.blocklyToolboxDiv {
    overflow: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.blocklyToolboxDiv::-webkit-scrollbar {
    display: none !important;
}

.drag-over {
    border: 2px dashed #3b82f6;
    background-color: #eff6ff;
}

/* 程式碼區域樣式 */
.code-editor {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    line-height: 1.5;
    tab-size: 4;
}

.code-editor:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px #3b82f6;
}

/* 輸出區域樣式 */
.output-area {
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
}

/* 測試結果樣式 */
.test-case {
    border-left: 4px solid #e5e7eb;
    padding-left: 12px;
    margin-bottom: 12px;
}

.test-case.success {
    border-left-color: #10b981;
    background-color: #f0fdf4;
}

.test-case.error {
    border-left-color: #ef4444;
    background-color: #fef2f2;
}

.test-case.timeout {
    border-left-color: #f59e0b;
    background-color: #fffbeb;
}
