/**
 * YEN Shop CONSOLE 通用樣式
 */

/* 基本變數 - 現在由 palette.css 提供 */
:root {
    /* 這些變數現在由 palette.css 定義，保留此處作為備用 */
    --primary-color: var(--primary-400, #D4A574);
    --secondary-color: var(--secondary-400, #A8B5A0);
    --accent-color: var(--accent-400, #C4A8A8);
    --tertiary-color: var(--tertiary-400, #A0A8B5);

    /* 灰色系現在使用溫暖的莫蘭迪色調 */
    --gray-50: var(--gray-50, #F8F7F6);
    --gray-100: var(--gray-100, #F0EFED);
    --gray-200: var(--gray-200, #E6E4E1);
    --gray-300: var(--gray-300, #D1CFC9);
    --gray-400: var(--gray-400, #B5B2AB);
    --gray-500: var(--gray-500, #9B978E);
    --gray-600: var(--gray-600, #7D7A72);
    --gray-700: var(--gray-700, #625F58);
    --gray-800: var(--gray-800, #4A4740);
    --gray-900: var(--gray-900, #332F2A);
}

/* 載入動畫 */
.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 平滑過渡效果 */
.smooth-transition {
    transition: all 0.3s ease-in-out;
}

/* 卡片懸停效果 */
.card-hover {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* 按鈕樣式 */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: var(--primary-500, #C49660);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
}

.btn-secondary:hover {
    background-color: var(--secondary-500, #95A58D);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 181, 160, 0.3);
}

.btn-danger {
    background-color: var(--error-500);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
}

.btn-danger:hover {
    background-color: var(--error-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(165, 132, 132, 0.3);
}

/* 輸入框樣式 */
.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease-in-out;
    background-color: var(--bg-secondary);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

.input-field:hover {
    border-color: var(--border-medium);
}

/* 表單輸入框樣式 */
.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-medium);
    border-radius: 0.75rem;
    background: white;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-input:hover {
    border-color: var(--border-dark);
}

/* 毛玻璃效果 */
.glass-effect {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    border-radius: 12px;
}

.glass-modal {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 40px 0 rgba(31, 38, 135, 0.2);
    border-radius: 16px;
}

.glass-sidebar {
    background: rgba(248, 247, 246, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.glass-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* 管理後台專用樣式 */
.admin-table {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.admin-table th {
    background: var(--gray-50);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.admin-table tr:hover {
    background: var(--gray-50);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

/* 側邊欄樣式 */
.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
    margin: 0 0.5rem;
}

.sidebar-nav a:hover {
    background-color: var(--gray-100);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, var(--primary-400), var(--primary-500));
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(212, 165, 116, 0.1);
    color: var(--primary-400);
    transform: translateX(2px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-400), var(--primary-500));
    color: white;
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.sidebar-nav svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .sidebar-nav a {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* 統計卡片樣式 */
.stat-card {
    background: linear-gradient(135deg, var(--bg-secondary), var(--gray-50));
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-400), var(--secondary-400));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.stat-change.positive {
    color: var(--success-500);
}

.stat-change.negative {
    color: var(--error-500);
}

/* Toast 通知樣式 */
.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--success-500);
}

.toast.error {
    border-left: 4px solid var(--error-500);
}

.toast.warning {
    border-left: 4px solid var(--warning-500);
}

.toast.info {
    border-left: 4px solid var(--info-500);
}

/* 模態框樣式 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

/* 表格樣式增強 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table th {
    background: var(--gray-50);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* 狀態標籤 */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.active {
    background: var(--success-100);
    color: var(--success-700);
}

.status-badge.inactive {
    background: var(--gray-100);
    color: var(--gray-700);
}

.status-badge.pending {
    background: var(--warning-100);
    color: var(--warning-700);
}

.status-badge.error {
    background: var(--error-100);
    color: var(--error-700);
}

/* 美觀的選擇器樣式 */
.form-select {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    border: 2px solid var(--border-medium);
    border-radius: 0.75rem;
    background: white;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
    background-color: white;
}

.form-select:hover {
    border-color: var(--border-dark);
    background-color: white;
}

/* 自定義選項樣式 */
.form-select option {
    background: white;
    color: var(--text-primary);
    padding: 0.5rem;
}

/* 緊湊版統計卡片樣式 */
.stat-card-compact {
    background: linear-gradient(135deg, var(--bg-secondary), var(--gray-50));
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card-compact::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-400), var(--secondary-400));
}

.stat-card-compact:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.stat-value-small {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-label-small {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.stat-change-small {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
}

.stat-change-small.positive {
    color: var(--success-700);
    background: var(--success-100);
}

.stat-change-small.negative {
    color: var(--error-700);
    background: var(--error-100);
}