/* --- 1. 基礎變數與重置 --- */
:root {
    /* 主色調：更現代的靛藍色 */
    --primary-color: #6366f1; 
    --primary-hover: #4f46e5;
    /* 次色調：溫暖的玫瑰紅 (給飼主用) */
    --secondary-color: #f43f5e;
    --secondary-hover: #e11d48;
    
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-sub: #6b7280;
    --border-radius: 16px; /* 更圓潤的導角 */
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 20px;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    background: var(--card-bg);
    width: 100%;
    max-width: 550px; 
    padding: 40px 30px; /* 增加內部留白 */
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover); /* 加強陰影 */
    box-sizing: border-box;
    margin-top: 30px;
    margin-bottom: 50px;
    animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1); /* 更滑順的進場動畫 */
    position: relative;
    overflow: hidden; /* 防止內容溢出圓角 */
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 2. 通用元件樣式 --- */
.main-logo {
    width: 100px;
    height: auto;
    display: block;
    margin: 0 auto 25px auto;
    object-fit: contain;
    transition: transform 0.3s;
}
.main-logo:hover {
    transform: scale(1.05) rotate(-3deg); /* 趣味的小動畫 */
}

h1 { margin: 0; font-size: 26px; color: var(--text-main); text-align: center; font-weight: 800; letter-spacing: -0.5px; }
h2 { margin: 0 0 20px 0; font-size: 22px; color: var(--text-main); font-weight: 700; }
h3 { font-size: 18px; margin: 20px 0 15px; color: #374151; font-weight: 600; }

.form-section { margin-bottom: 24px; }
label { 
    display: block; 
    margin-bottom: 8px; 
    font-weight: 600; 
    font-size: 14px; 
    color: #4b5563; 
}
.hint-text { font-size: 13px; color: #9ca3af; margin-top: 6px; }

/* 輸入框優化 */
input[type="text"], 
input[type="number"], 
input[type="email"], 
input[type="date"],
select, 
textarea {
    width: 100%; 
    padding: 14px; /* 加大點擊範圍 */
    border: 2px solid #e5e7eb; /* 預設淺灰框 */
    border-radius: 12px;
    font-size: 15px; 
    box-sizing: border-box; 
    background: #f9fafb;
    font-family: inherit;
    transition: all 0.2s;
    color: #374151;
}

/* 聚焦時的效果 */
input:focus, select:focus, textarea:focus { 
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1); /* 柔和光暈 */
}

/* 按鈕群組 */
.btn-group { display: flex; gap: 12px; margin-top: 25px; }

/* 主要按鈕 */
.submit-btn {
    width: 100%; 
    padding: 16px; 
    background-color: var(--primary-color); 
    color: white;
    border: none; 
    border-radius: 12px; 
    font-size: 16px; 
    font-weight: 700;
    cursor: pointer; 
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.2);
}
.submit-btn:hover { 
    background-color: var(--primary-hover); 
    transform: translateY(-2px); /* 懸浮效果 */
    box-shadow: 0 6px 10px rgba(99, 102, 241, 0.3);
}
.submit-btn:active {
    transform: translateY(0);
}
.submit-btn:disabled { 
    background-color: #d1d5db; 
    cursor: not-allowed; 
    box-shadow: none;
    transform: none;
}

/* 次要按鈕 */
.secondary-btn {
    width: 100%; 
    padding: 16px; 
    background-color: #f3f4f6; 
    color: #4b5563;
    border: none; 
    border-radius: 12px; 
    font-size: 16px; 
    font-weight: 600;
    cursor: pointer; 
    transition: all 0.2s;
}
.secondary-btn:hover { 
    background-color: #e5e7eb; 
    color: #1f2937;
}

/* --- 3. 頁面特定樣式 --- */

/* 頁面切換控制 */
.page-section { display: none; }
.page-section.active { display: block; animation: fadeEffect 0.3s; }
@keyframes fadeEffect { from {opacity: 0;} to {opacity: 1;} }

/* 首頁樣式 */
.hero-section { text-align: center; padding: 10px 0 30px; }
.feature-grid { 
    display: flex; 
    gap: 12px; 
    margin: 30px 0; 
    justify-content: center; 
}
.feature-item { 
    background: #fff; 
    padding: 8px 16px; 
    border-radius: 20px; 
    font-size: 13px; 
    font-weight: 500;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* 同意書樣式 (維持您之前的要求) */
.agreement-box {
    color: #6B7280; 
    font-size: 13px;
    line-height: 1.8;
    border: 1px solid #E5E7EB;
    background-color: #F9FAFB;
    border-radius: 12px;
    padding: 20px;
    height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.03);
}
.agreement-box h3, .agreement-box h4 { color: #374151; }

.disclaimer-text {
    font-size: 12px;
    color: #9CA3AF;
    margin-bottom: 20px;
    line-height: 1.6;
    text-align: justify;
    padding: 0 5px;
}

.checkbox-wrapper {
    display: flex; 
    align-items: center; 
    gap: 12px; 
    background: #fff; 
    padding: 16px; 
    border: 2px solid #E5E7EB; 
    border-radius: 12px;
    margin-bottom: 25px;
    transition: all 0.3s;
    cursor: pointer;
}
.checkbox-wrapper:hover { border-color: #d1d5db; }
.checkbox-wrapper.disabled {
    background: #F9FAFB;
    opacity: 0.6;
    cursor: not-allowed;
    border-color: #E5E7EB;
}
input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color); /* 讓勾選框變色 */
}

/* --- 4. Profile 設定頁樣式 --- */
.role-switch-container {
    display: flex; 
    background: #f1f5f9; 
    padding: 6px; 
    border-radius: 16px; 
    margin-bottom: 30px;
}
.role-btn {
    flex: 1; 
    padding: 12px; 
    border-radius: 12px; 
    border: none; 
    cursor: pointer;
    font-weight: 700; 
    font-size: 15px; 
    transition: 0.3s;
    background: transparent; 
    color: #64748b;
}
.role-btn.active { 
    background: white; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); 
    color: var(--primary-color); 
}
/* 飼主激活時變紅色系 */
.role-btn[data-role="owner"].active { color: var(--secondary-color); }

/* 標籤容器 */
.tags-container { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-pill {
    padding: 8px 16px; 
    background-color: #fff; 
    border: 1px solid #e2e8f0; 
    border-radius: 20px;
    font-size: 14px; 
    color: #64748b;
    cursor: pointer; 
    transition: all 0.2s; 
    user-select: none;
    font-weight: 500;
}
.tag-pill:hover { 
    border-color: var(--primary-color); 
    background-color: #eef2ff; 
    color: var(--primary-color);
}
.tag-pill.selected {
    background-color: var(--primary-color); 
    color: white; 
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}
/* 飼主標籤選中樣式 */
.owner-view .tag-pill.selected { 
    background-color: var(--secondary-color); 
    border-color: var(--secondary-color);
    box-shadow: 0 4px 6px -1px rgba(244, 63, 94, 0.3);
}
.owner-view .tag-pill:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background-color: #fff1f2;
}

.profile-avatar {
    width: 100px; 
    height: 100px; 
    border-radius: 50%; 
    margin: 0 auto 20px;
    display: block; 
    background-color: #f1f5f9;
    /* 增加一點邊框讓頭像更立體 */
    border: 4px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Dashboard 樣式 */
.dashboard-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 2px solid #f3f4f6; 
    padding-bottom: 20px; 
    margin-bottom: 25px; 
}
.user-badge { display: flex; align-items: center; gap: 15px; }
.user-badge img { 
    width: 45px; 
    height: 45px; 
    border-radius: 50%; 
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}