/* SpellShare 自定義樣式 */

/* 平滑過渡效果 */
* {
    transition: all 0.2s ease-in-out;
}

/* 劇情卡片增強 */
.spell-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.spell-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 劇情內容文字樣式 */
.spell-content {
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}

/* 複製按鈕特效 */
.copy-btn {
    position: relative;
    overflow: hidden;
}

.copy-btn:hover {
    transform: scale(1.1);
}

.copy-btn:active {
    transform: scale(0.95);
}



.copy-success {
    animation: copySuccess 0.3s ease-in-out;
}

/* Toast 訊息動畫 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

#copy-toast {
    animation: slideInRight 0.3s ease-out;
}

#copy-toast.hiding {
    animation: slideOutRight 0.3s ease-in;
}

/* 表單增強樣式 */
.form-input:focus {
    ring-width: 2px;
    ring-color: rgb(59, 130, 246);
    border-color: rgb(59, 130, 246);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 文字區域調整 */
textarea {
    resize: vertical;
    min-height: 120px;
}

/* 載入動畫增強 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-text {
    animation: pulse 1.5s ease-in-out infinite;
}

/* 按鈕增強效果 */
.btn-primary {
    background: linear-gradient(135deg, rgb(59, 130, 246), rgb(37, 99, 235));
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, rgb(37, 99, 235), rgb(29, 78, 216));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.4);
}

/* 導航列增強 */
nav {
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

/* 卡片網格響應式調整 */
@media (max-width: 640px) {
    .spell-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .spell-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .spell-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

/* 空狀態樣式 */
.empty-state {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.empty-state:hover {
    opacity: 1;
}

/* 統計數字增強 */
.stat-number {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* 作者標籤樣式 */
.author-badge {
    background: linear-gradient(135deg, rgb(99, 102, 241), rgb(67, 56, 202));
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* 日期顯示樣式 */
.date-text {
    font-variant-numeric: tabular-nums;
    color: rgb(107, 114, 128);
}

/* 滾動條美化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgb(243, 244, 246);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgb(156, 163, 175);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgb(107, 114, 128);
}

/* 選擇器樣式增強 */
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    appearance: none;
    padding-right: 2.5rem;
}

/* 表單標籤增強 */
label {
    font-weight: 500;
    letter-spacing: 0.025em;
}

/* 必填星號樣式 */
.required {
    color: rgb(239, 68, 68);
    margin-left: 0.125rem;
}

/* 導航列響應式調整 */
@media (max-width: 640px) {
    .nav-welcome {
        display: none;
    }
    
    .nav-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* 劇情內容文字樣式 */
.spell-content {
    text-align: left !important;
    white-space: normal; /* 改為 normal，不保留前導空格 */
    word-break: break-word;
    direction: ltr !important;
    line-height: 1.6;
}

/* Logo 樣式 */
.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-container img {
    border-radius: 0.375rem;
    object-fit: contain;
}

/* 載入覆蓋層美化 */
#loading-overlay {
    backdrop-filter: blur(4px);
    background-color: rgba(0, 0, 0, 0.3);
}

#loading-overlay > div {
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

/* 動畫關鍵幀 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* 錯誤和成功訊息動畫 */
#error-message, #success-message {
    animation: fadeInUp 0.3s ease-out;
}

/* 提高可讀性的文字對比 */
.text-contrast {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 焦點可見性增強 */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid rgb(59, 130, 246);
    outline-offset: 2px;
}

/* 深色模式準備（可選） */
@media (prefers-color-scheme: dark) {
    /* 暫時保留，未來可能啟用深色模式 */
}

/* 在現有的 .copy-btn 樣式後面添加： */

/* 分享按鈕特效 */
.share-btn {
    position: relative;
    overflow: hidden;
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-btn:active {
    transform: scale(0.95);
}

.share-btn:hover svg {
    color: #8b5cf6 !important; /* 紫色 hover 效果 */
}

/* 分享成功動畫 */
.share-success {
    animation: shareSuccess 0.3s ease-in-out;
}

@keyframes shareSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* 分享模板字體確保 */
#share-template {
    font-family: 'Noto Sans TC', sans-serif;
}

/* 分享模板文字陰影增強可讀性 */
#share-template #share-title,
#share-template #share-subtitle,
#share-template #share-content { text-shadow: none !important; }

/* 分享預覽 Modal 樣式增強 */
#share-preview-modal {
    backdrop-filter: blur(8px);
    animation: modalFadeIn 0.3s ease-out;
}

#share-preview-modal > div {
    animation: modalSlideIn 0.3s ease-out;
    transform-origin: center;
}

/* Modal 動畫 */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* 預覽圖片樣式 */
#preview-image {
    max-height: 500px;
    transition: transform 0.2s ease;
    border: 2px solid rgba(112, 215, 221, 0.2);
}

#preview-image:hover {
    transform: scale(1.02);
}

/* 載入動畫增強 */
#share-loading svg {
    filter: drop-shadow(0 2px 4px rgba(112, 215, 221, 0.3));
}

/* 按鈕增強效果 */
#preview-buttons button {
    position: relative;
    overflow: hidden;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#preview-buttons button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

#preview-buttons button:hover:before {
    left: 100%;
}

/* 下載按鈕特殊效果 */
#download-btn:hover {
    box-shadow: 0 8px 25px rgba(112, 215, 221, 0.4);
}

/* 分享按鈕特殊效果 */
#native-share-btn:hover {
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

/* 回到主頁按鈕特殊效果 */
#home-btn:hover {
    background: linear-gradient(135deg, #4b5563, #374151);
    box-shadow: 0 8px 25px rgba(75, 85, 99, 0.4);
}

/* 關閉按鈕增強 */
#share-preview-modal .absolute.top-4.right-4 {
    transition: all 0.2s ease;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#share-preview-modal .absolute.top-4.right-4:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

/* 響應式調整 */
@media (max-width: 640px) {
    #share-preview-modal > div {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
    
    #preview-buttons {
        flex-direction: column;
        space-y: 0.75rem;
    }
    
    #preview-buttons button {
        width: 100%;
        margin-bottom: 0.75rem;
    }
    
    #preview-buttons button:last-child {
        margin-bottom: 0;
    }
    
    #preview-image {
        max-height: 300px;
    }
}

/* 成功狀態動畫 */
.share-preview-success {
    animation: successPulse 0.6s ease-in-out;
}

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

/* 分享模板字體確保 */
#share-template {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* 分享模板文字優化 */
#share-template #share-title,
#share-template #share-subtitle,
#share-template #share-content { text-shadow: none !important; line-height: 34px;}

/* 深色模式兼容（可選） */
@media (prefers-color-scheme: dark) {
    #share-preview-modal > div {
        background: rgba(31, 41, 55, 0.95);
        color: white;
    }
}
