/* css/style.css */

/* --- 全域設定 --- */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft JhengHei", sans-serif; 
    -webkit-tap-highlight-color: transparent; 
}

/* 確保背景填滿 */
html, body {
    height: 100%;
    width: 100%;
    overflow: hidden; 
    background-color: #000;
}

body {
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
header { 
    background-color: #000; 
    height: 100px; 
    display: flex; 
    align-items: center; 
    padding: 0 24px; 
    justify-content: space-between; 
    color: white; 
    flex-shrink: 0; 
}

.logo-area { display: flex; align-items: center; }
.logo-img { height: 50px; width: auto; object-fit: contain; cursor: pointer; }
.search-area { flex-grow: 1; display: flex; justify-content: center; align-items: center; margin: 0 20px; }
.search-container { position: relative; display: flex; align-items: center; width: 100%; max-width: 520px; }
.search-input { width: 100%; padding: 12px 20px; padding-right: 50px; border-radius: 12px; border: none; outline: none; font-size: 1rem; height: 44px; background-color: #fff; color: #333; }
.search-icon-img { position: absolute; right: -40px; width: 20px; height: 20px; cursor: pointer; object-fit: contain; }
.header-icons { display: flex; gap: 24px; align-items: center; }
.icon-btn-img { width: 24px; height: 24px; cursor: pointer; object-fit: contain; display: block; }

/* --- Main Layout Containers --- */
.main-container, .detail-container { 
    display: flex; 
    flex: 1; 
    width: 100%;
    height: 100%;
    overflow: hidden; 
}

.detail-container { 
    background-color: rgba(7, 35, 125, 1); 
    padding: 40px; 
    gap: 30px; 
    justify-content: center; 
    align-items: stretch; 
}

/* --- Sidebar --- */
aside { width: 260px; background-color: rgba(193, 193, 193, 1); display: flex; flex-direction: column; flex-shrink: 0; border-right: 1px solid rgba(142, 142, 142, 1); overflow-y: auto; }
.menu-item { padding: 16px 24px; font-size: 1.1rem; color: #444; cursor: pointer; border-bottom: 1px solid rgba(142, 142, 142, 1); display: flex; justify-content: space-between; align-items: center; font-weight: 600; letter-spacing: 1px; transition: background-color 0.2s; }
.menu-item:first-child { border-top: 1px solid rgba(142, 142, 142, 1); }
.menu-item:hover { background-color: rgba(255, 255, 255, 0.4); color: #000; }
.menu-item.active-filter { background-color: rgba(255, 255, 255, 0.6); color: #000; }
.chevron-icon-img { width: 14px; height: 14px; object-fit: contain; opacity: 0.6; transition: transform 0.3s ease; }
.submenu-container { max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out; background-color: rgba(180, 180, 180, 1); }
.submenu-item { padding: 12px 24px 12px 40px; font-size: 1rem; color: #555; cursor: pointer; border-bottom: 1px solid rgba(142, 142, 142, 1); transition: background-color 0.2s; }
.submenu-item:hover { background-color: rgba(255, 255, 255, 0.3); color: #000; }
.submenu-item.active-filter { background-color: rgba(255, 255, 255, 0.5); color: #000; font-weight: 700; }
.submenu-item.child-category { padding-left: 60px; font-size: 0.95rem; border-left: 4px solid transparent; }
.submenu-item.child-category.active-filter { border-left: 4px solid #555; }
.menu-item.active .chevron-icon-img { transform: rotate(180deg); }

.tags-section { padding: 20px 24px; }
.tags-title { color: #666; font-size: 1.1rem; margin-bottom: 16px; font-weight: 600; }
.tags-container { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-pill { background-color: #fff; padding: 6px 16px; border-radius: 20px; font-size: 0.85rem; color: #333; border: 1px solid rgba(142, 142, 142, 1); cursor: pointer; font-weight: 500; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s; }
.tag-pill:hover { transform: translateY(-1px); box-shadow: 0 4px 6px rgba(0,0,0,0.15); }
.tag-pill.active-filter { background-color: #333; color: #fff; border-color: #333; }

/* --- Main Content (Dashboard) --- */
main { 
    flex: 1; 
    background-color: rgba(7, 35, 125, 1); 
    padding: 30px 40px; 
    overflow-y: auto; 
    overflow-x: hidden; 
}

.section-header { 
    color: #fff; 
    font-size: 1.5rem; 
    margin-bottom: 20px; 
    font-weight: 700; 
    letter-spacing: 1px; 
}

/* [修改] 網格佈局 (Grid Layout) */
.assets-grid {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 16px; 
    /* 減少 padding，讓卡片有更多空間可以變寬 */
    padding: 20px; 
    
    margin-bottom: 30px;
    display: grid;
    /* 強制一行顯示 6 個 */
    grid-template-columns: repeat(6, 1fr);
    /* 減少間距，讓卡片有更多空間變寬 */
    gap: 15px;       
    align-items: flex-start;
    min-height: 200px;
}

/* [修改] 卡片樣式 */
.card { 
    background-color: #fff; 
    width: 100%; 
    height: 300px; /* 稍微加高 */
    border-radius: 16px; 
    /* [關鍵] 增加上方 padding，讓愛心有獨立空間，不壓到圖片 */
    padding: 12px;
    padding-top: 45px; 
    
    position: relative; 
    display: flex; 
    flex-direction: column; 
    justify-content: flex-start; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); 
    transition: transform 0.2s; 
    cursor: pointer; 
    text-decoration: none; 
}

.card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 8px 20px rgba(0,0,0,0.2); 
}

.card.hidden { display: none !important; }

/* [修改] 愛心按鈕位置 */
.favorite-btn { 
    position: absolute; 
    /* 固定在右上角，位於 padding-top 預留的白底區域 */
    top: 10px; 
    right: 12px; 
    width: 22px; 
    height: 22px; 
    cursor: pointer; 
    z-index: 10; 
    transition: transform 0.2s; 
}
.favorite-btn:hover { transform: scale(1.2); }

/* 卡片內圖片容器 */
.card-img-container {
    width: 100%;
    height: 160px; 
    background-color: #f8f8f8;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 文字樣式 */
.card-title { 
    color: #333; 
    font-size: 1rem; 
    font-weight: 700; 
    margin-bottom: 8px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.card-tag-display { 
    background-color: #eee; 
    color: #666; 
    font-size: 0.8rem; 
    padding: 4px 10px; 
    border-radius: 12px; 
    align-self: flex-start; 
    margin-bottom: auto;    
    max-width: 100%; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.card-version { 
    color: #999; 
    align-self: flex-end; 
    font-weight: 600; 
    font-size: 0.85rem;
    margin-top: 5px;
}

/* --- Detail View Panels --- */
.preview-panel { flex: 1; background-color: #fff; border-radius: 20px; padding: 30px; display: flex; flex-direction: column; justify-content: center; align-items: center; box-shadow: 0 10px 30px rgba(0,0,0,0.2); position: relative; }
.preview-box { width: 90%; height: 80%; border: 8px solid #E0E0E0; border-radius: 8px; display: flex; justify-content: center; align-items: center; margin-bottom: 20px; }
.preview-text { color: #999; font-size: 1.5rem; font-weight: 600; letter-spacing: 1px; }
.preview-controls { display: flex; gap: 50px; margin-top: 10px; align-items: center; }
.nav-arrow { width: 18px; height: 18px; cursor: pointer; opacity: 0.6; transition: opacity 0.2s; }
.nav-arrow:hover { opacity: 1; }

.info-panel { width: 400px; background-color: #fff; border-radius: 20px; padding: 40px 35px; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,0.2); position: relative; overflow-y: hidden; }

/* Detail Page Header Icons */
.panel-header-actions { position: absolute; top: 35px; right: 35px; display: flex; align-items: center; gap: 20px; z-index: 20; }
.list-icon, .detail-heart-btn { position: static; width: 22px; height: auto; object-fit: contain; cursor: pointer; opacity: 0.8; transition: transform 0.2s; }
.list-icon:hover, .detail-heart-btn:hover { transform: scale(1.1); opacity: 1; }

.file-title { color: rgba(7, 35, 125, 1); font-size: 1.5rem; font-weight: 800; text-align: center; margin-bottom: 5px; margin-top: 10px; }
.file-id { color: #999; font-size: 1rem; text-align: center; margin-bottom: 35px; font-weight: 600; }
.info-row { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid #ddd; font-size: 1.1rem; }
.info-label { color: rgba(7, 35, 125, 1); font-weight: 700; }
.info-value { color: #666; font-weight: 500; }

.version-section { margin-top: 40px; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.version-header { display: flex; align-items: center; gap: 10px; color: rgba(7, 35, 125, 1); font-size: 1.15rem; font-weight: 700; margin-bottom: 15px; flex-shrink: 0; }
.plus-icon { width: 20px; height: 20px; cursor: pointer; transition: transform 0.2s; }
.plus-icon:hover { transform: scale(1.1); }
.version-scroll-list { overflow-y: auto; max-height: 200px; padding-right: 5px; scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.2) transparent; }
.version-scroll-list::-webkit-scrollbar { width: 4px; }
.version-scroll-list::-webkit-scrollbar-track { background: transparent; }
.version-scroll-list::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.2); border-radius: 10px; }
.version-btn { display: flex; justify-content: space-between; padding: 14px 25px; border-radius: 30px; margin-bottom: 12px; cursor: pointer; font-weight: 600; font-size: 1rem; transition: background-color 0.2s; }
.version-btn.active { background-color: #8E8E8E; color: white; box-shadow: 0 3px 8px rgba(0,0,0,0.2); }
.version-btn.inactive { background-color: #D6D6D6; color: #666; }
.version-btn.inactive:hover { background-color: #C0C0C0; }

/* Dropdown */
.dropdown-menu { position: absolute; top: 65px; right: 35px; background-color: #D3D3D3; border-radius: 12px; padding: 0; overflow: hidden; width: 100px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); display: none; z-index: 30; flex-direction: column; }
.dropdown-menu.show { display: flex; animation: fadeIn 0.2s ease; }
.menu-option { padding: 12px 0; text-align: center; color: #555; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background-color 0.2s; border-bottom: 1px solid rgba(255,255,255,0.3); }
.menu-option:last-child { border-bottom: none; }
.menu-option:hover { background-color: #C0C0C0; color: #333; }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.4); backdrop-filter: blur(5px); z-index: 1000; display: none; justify-content: center; align-items: center; animation: fadeInOverlay 0.3s ease-out; }
@keyframes fadeInOverlay { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop { 0% { opacity: 0; transform: scale(0.9) translateY(20px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }

.modal-box, .share-modal-box, .modal-box-common, .restore-modal-box {
    background-color: #fff;
    width: 700px;
    height: auto;
    border-radius: 20px;
    padding: 20px 40px 40px 40px; 
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    animation: modalPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.share-modal-box { width: 600px; }
.restore-modal-box { width: 500px; padding: 50px 40px; text-align: center; align-items: center; }

.close-modal-x {
    position: absolute;
    top: 15px;
    right: 40px; 
    font-size: 1.8rem;
    color: #333;
    cursor: pointer;
    z-index: 10;
    font-family: sans-serif;
    line-height: 1;
}

.modal-buttons { display: flex; justify-content: center; gap: 30px; margin-top: 20px; }
.btn-action, .btn-modal { padding: 10px 50px; border-radius: 12px; border: none; font-size: 1.1rem; font-weight: 600; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.1); transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1); }
.btn-action:active, .btn-modal:active { transform: scale(0.96); }
.btn-save, .btn-upload { background-color: #D2E3FC; color: #333; }
.btn-cancel { background-color: #F9E8BD; color: #333; }

.success-message { display: none; color: rgba(7, 35, 125, 1); font-size: 1.4rem; font-weight: 700; text-align: center; margin-top: 10px; animation: fadeInOverlay 0.5s ease; }
.success-toast { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); background-color: rgba(7, 35, 125, 0.9); color: white; padding: 10px 30px; border-radius: 30px; font-weight: 600; display: none; animation: fadeUp 0.3s ease-out; z-index: 9999; }
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Other Modal Elements */
.edit-title { text-align: center; font-size: 1.5rem; font-weight: 800; color: rgba(7, 35, 125, 1); margin-bottom: 25px; margin-top: 20px; }
.form-group { display: flex; align-items: center; margin-bottom: 20px; }
.form-label { width: 80px; font-size: 1.1rem; font-weight: 700; color: #333; text-align: right; margin-right: 20px; }
.edit-input { flex-grow: 1; background-color: #D3D3D3; border: none; border-radius: 30px; padding: 10px 25px; font-size: 1rem; font-weight: 600; color: #333; outline: none; }
.edit-input:focus { background-color: #C0C0C0; }

.share-link-row { display: flex; align-items: center; margin-bottom: 25px; margin-top: 45px; }
.url-box { flex-grow: 1; background-color: #D3D3D3; border-radius: 30px; padding: 12px 25px; font-size: 1.1rem; font-weight: 700; color: #333; text-decoration: underline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-icon-img { width: 28px; height: 28px; object-fit: contain; margin-left: 20px; cursor: pointer; opacity: 0.8; }
.share-controls-row { display: flex; align-items: center; gap: 15px; }
.control-label { font-weight: 800; font-size: 1.1rem; color: #222; }
.control-pill { background-color: #D3D3D3; border: none; border-radius: 20px; padding: 8px 20px; font-size: 1rem; font-weight: 700; color: #333; cursor: pointer; outline: none; text-align: center; font-family: inherit; }
.permission-select { min-width: 140px; appearance: none; -webkit-appearance: none; background-image: url('../static/image/down_black.png'); background-repeat: no-repeat; background-position: right 15px center; background-size: 12px; padding-right: 35px; text-align-last: center; }
.date-input { min-width: 160px; padding: 7px 20px; color: #333; }
.date-input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.6; }

.drop-zone { 
    flex: 1; 
    width: 100%;
    background-color: rgba(235, 235, 235, 1); 
    border: 3px dashed rgba(142, 142, 142, 1); 
    border-radius: 16px; 
    margin-bottom: 10px; 
    margin-top: 35px; 
    min-height: 250px; 
    max-height: 300px;
    display: flex; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; position: relative; overflow: hidden; transition: border-color 0.2s; 
}
.drop-zone:hover { border-color: #666; }
.drop-zone.has-file { justify-content: flex-start; align-items: stretch; padding-top: 0; }
.empty-state-content { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; }
.folder-icon { width: 60px; height: 60px; object-fit: contain; opacity: 0.6; margin-bottom: 10px; }
.drop-text { font-size: 1.1rem; font-weight: 600; color: #666; letter-spacing: 1px; }
.file-list-item { display: flex; align-items: center; justify-content: space-between; padding: 15px 25px; width: 100%; border-bottom: 1px solid rgba(142, 142, 142, 1); }
.file-info-left { display: flex; align-items: center; overflow: hidden; }
.check-icon { width: 24px; height: 24px; object-fit: contain; margin-right: 15px; opacity: 0.8; flex-shrink: 0; }
.file-name-text { font-size: 1rem; font-weight: 600; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 350px; }
.restore-message { font-size: 1.25rem; font-weight: 700; color: #333; line-height: 1.6; margin-bottom: 30px; }

/* Notification Sidebar */
.notification-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.3); z-index: 2999; display: none; opacity: 0; transition: opacity 0.3s ease; }
.notification-overlay.show { display: block; opacity: 1; }
.notification-sidebar { position: fixed; top: 0; right: -400px; width: 360px; height: 100%; background-color: #fff; box-shadow: -5px 0 20px rgba(0,0,0,0.15); z-index: 3000; display: flex; flex-direction: column; transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); }
.notification-sidebar.show { right: 0; }
.notify-header { padding: 25px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.notify-header h3 { margin: 0; font-size: 1.4rem; color: #333; font-weight: 800; }
.close-notify { font-size: 1.8rem; color: #999; cursor: pointer; line-height: 1; transition: color 0.2s; }
.close-notify:hover { color: #333; }
.notify-list { flex: 1; overflow-y: auto; padding: 0; }
.notify-item { display: flex; padding: 20px 25px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background-color 0.2s; position: relative; }
.notify-item:hover { background-color: #fafafa; }
.notify-item.unread { background-color: #f0f7ff; }
.notify-icon-box { width: 40px; height: 40px; border-radius: 50%; background-color: #eee; display: flex; justify-content: center; align-items: center; margin-right: 15px; flex-shrink: 0; overflow: hidden; }
.notify-icon-box img { width: 20px; height: 20px; opacity: 0.6; }
.notify-content { flex: 1; }
.notify-text { font-size: 0.95rem; color: #444; margin: 0 0 5px 0; line-height: 1.4; }
.notify-text .highlight { color: rgba(7, 35, 125, 1); font-weight: 600; }
.notify-time { font-size: 0.8rem; color: #999; }
.unread-dot { width: 8px; height: 8px; background-color: #ff4d4f; border-radius: 50%; position: absolute; top: 25px; right: 20px; }

/* MFA Success */
body.mfa-body { background-color: #fff; display: flex; flex-direction: column; margin: 0; overflow: hidden; }
.mfa-header { background-color: rgba(7, 35, 125, 1); height: 160px; width: 100%; display: flex; justify-content: center; align-items: center; flex-shrink: 0; }
.system-title { color: white; font-size: 2.8rem; font-weight: 800; letter-spacing: 1px; }
.mfa-content { flex: 1; display: flex; justify-content: center; align-items: center; background-color: #fff; }
.success-card { background-color: #D9D9D9; width: 280px; height: 340px; border-radius: 20px; display: flex; flex-direction: column; justify-content: center; align-items: center; box-shadow: 0 4px 15px rgba(0,0,0,0.1); animation: popIn 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.icon-circle { width: 90px; height: 90px; background-color: #fff; border-radius: 50%; display: flex; justify-content: center; align-items: center; margin-bottom: 30px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); position: relative; }
.success-text { font-size: 1.6rem; font-weight: 700; color: #888; letter-spacing: 1px; }
.mfa-footer { background-color: rgba(7, 35, 125, 1); height: 100px; width: 100%; flex-shrink: 0; }
.check-svg { width: 50px; height: 50px; display: block; animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) 0.2s forwards; }
.checkmark-circle { fill: none; stroke-width: 3; stroke: #28a745; stroke-miterlimit: 10; opacity: 0; animation: fadeCircle 0.3s ease-in-out 0.2s forwards; }
.checkmark-check { transform-origin: 50% 50%; stroke-width: 4; stroke-dasharray: 48; stroke-dashoffset: 48; stroke: #28a745; stroke-linecap: round; stroke-linejoin: round; }
@keyframes stroke { 100% { stroke-dashoffset: 0; } }
@keyframes fadeCircle { 100% { opacity: 1; } }