/* 全域樣式 */
:root {
    --primary-color: #1a1a1a;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #000000;
    --text-light: #ffffff;
    --text-dark: #333333;
    --bg-dark: #1a1a1a;
    --bg-darker: #0f0f0f;
    --border-color: #333333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    scroll-behavior: smooth;
    background-color: var(--bg-dark);
    color: var(--text-light);
}

/* 導航列樣式 */
.navbar {
    border-bottom: 2px solid var(--warning-color);
    box-shadow: 0 2px 10px rgba(255, 193, 7, 0.2);
}

.navbar-brand {
    font-size: 1.5rem;
    letter-spacing: 1px;
    margin-left: 10px;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--warning-color) !important;
}

/* 主要橫幅樣式 */
.hero-section {
    /* Fallback background */
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 50%, #1a252f 100%);
    /* Background image with overlay */
    background: linear-gradient(rgba(44, 62, 80, 0.7), rgba(52, 73, 94, 0.7), rgba(26, 37, 47, 0.8)), 
                url('../img/index/Chiayi-pawnshop.webp');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    /* 確保在各種設備上都能正常顯示 */
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.hero-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><defs><pattern id="pattern1" x="0" y="0" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="2" fill="rgba(255,193,7,0.1)"/></pattern></defs><rect width="100%" height="100%" fill="url(%23pattern1)"/></svg>');
    opacity: 0.3;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 3;
    animation: fadeInUp 1s ease-out;
    padding-left: 2rem;
    text-align: left;
}

.hero-buttons .btn {
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.hero-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* 服務項目樣式 */
.service-card {
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    background-color: var(--primary-color);
    color: var(--text-light);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(255,255,255,0.1) !important;
    background-color: var(--bg-darker);
}

.service-card .card-body {
    padding: 2rem !important;
}

.service-card i {
    transition: all 0.3s ease;
}

.service-card:hover i {
    transform: scale(1.1);
}

/* 優勢特色樣式 */
.feature-item {
    animation: fadeInUp 0.6s ease-out;
    color: var(--text-light);
}

.feature-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--warning-color), #ffdb4d);
}

.feature-item:hover .feature-icon {
    transform: rotate(360deg) scale(1.1);
}

.feature-item h5 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* 申請流程樣式 */
.process-timeline {
    position: relative;
    padding: 2rem 0;
}

.process-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--warning-color), #ffdb4d);
    transform: translateX(-50%);
}

.process-item {
    display: flex;
    align-items: center;
    margin-bottom: 3rem;
    position: relative;
}

.process-item:nth-child(even) {
    flex-direction: row-reverse;
}

.process-item:nth-child(even) .process-content {
    text-align: right;
    padding-right: 2rem;
}

.process-item:nth-child(odd) .process-content {
    padding-left: 2rem;
}

.process-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--warning-color), #ffdb4d);
    color: var(--dark-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 15px rgba(255,255,255,0.2);
}

.process-content {
    flex: 1;
    max-width: calc(50% - 30px);
}

.process-content h5 {
    font-weight: 600;
    color: var(--warning-color);
    margin-bottom: 0.5rem;
}

.process-content p {
    color: var(--text-light);
    margin-bottom: 0;
}

/* 聯絡我們樣式 */
.contact-info {
    padding: 2rem;
    transition: all 0.3s ease;
}

.contact-info:hover {
    transform: translateY(-5px);
}

.contact-info i {
    opacity: 0.8;
    transition: all 0.3s ease;
}

.contact-info:hover i {
    opacity: 1;
    transform: scale(1.1);
}

.contact-form-container {
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid rgba(255,255,255,0.2);
}

.contact-form-container .form-control,
.contact-form-container .form-select {
    background: rgba(255,255,255,0.95);
    color: var(--text-dark);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-weight: 500;
}

.contact-form-container .form-control:focus,
.contact-form-container .form-select:focus {
    background: white;
    box-shadow: 0 0 0 0.25rem rgba(255,193,7,0.25);
    border-color: var(--warning-color);
}

/* 動畫效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 滾動動畫 */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .hero-section {
        background-attachment: scroll;
        background-size: cover;
        background-position: center center;
        min-height: 80vh;
    }
    
    .hero-content {
        text-align: center;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .process-timeline::before {
        left: 30px;
    }
    
    .process-item {
        flex-direction: row !important;
        padding-left: 80px;
    }
    
    .process-item .process-content {
        text-align: left !important;
        padding-left: 2rem !important;
        padding-right: 0 !important;
        max-width: none;
    }
    
    .process-number {
        position: absolute;
        left: 0;
    }
    
    .contact-form-container {
        margin-top: 2rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        background-attachment: scroll;
        background-size: cover;
        background-position: center center;
        min-height: 70vh;
    }
    
    .hero-content {
        text-align: center;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    .hero-buttons .btn {
        display: block;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

/* 大螢幕優化 */
@media (min-width: 1200px) {
    .hero-section {
        background-size: cover;
        background-position: center center;
        min-height: 100vh;
    }
}

/* 中等螢幕優化 */
@media (max-width: 992px) {
    .hero-section {
        background-attachment: scroll;
        background-size: cover;
        background-position: center center;
    }
}

/* 載入動畫 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 成功訊息樣式 */
.alert-success {
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--success-color), #20c997);
    color: white;
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--warning-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ffdb4d;
}

/* 按鈕懸停效果增強 */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::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;
}

.btn:hover::before {
    left: 100%;
}

/* 頁尾樣式 */
footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-darker) !important;
}

footer .row {
    justify-content: center;
    align-items: center;
    text-align: center;
}

footer .col-md-6 {
    text-align: center !important;
}

footer p {
    margin: 0;
    font-size: 0.9rem;
}

/* 自定義工具提示 */
.tooltip-custom {
    position: relative;
    cursor: help;
}

.tooltip-custom::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.tooltip-custom:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

/* 深色主題額外樣式 */
section {
    background-color: var(--bg-dark);
}

section:nth-child(even) {
    background-color: var(--primary-color);
}

.bg-light {
    background-color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--bg-darker) !important;
}

.text-muted {
    color: #cccccc !important;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-light);
}

.lead {
    color: var(--text-light);
}

.card-title {
    color: var(--text-light) !important;
}

.card-text {
    color: #cccccc !important;
}

/* 導航列深色主題 */
.navbar-dark .navbar-nav .nav-link.active {
    color: var(--warning-color) !important;
}

/* 按鈕樣式調整 */
.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #ffdb4d);
    border: none;
    color: var(--dark-color);
    font-weight: 600;
}

.btn-outline-light {
    border-color: var(--text-light);
    color: var(--text-light);
}

.btn-outline-light:hover {
    background-color: var(--text-light);
    color: var(--dark-color);
}

/* 表單驗證樣式 */
.form-control.is-valid {
    border-color: var(--success-color);
    background-color: rgba(255,255,255,0.95);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
    background-color: rgba(255,255,255,0.95);
}

/* 成功訊息深色主題 */
.alert-success {
    background: linear-gradient(135deg, var(--success-color), #20c997);
    border: 1px solid rgba(255,255,255,0.2);
}

/* 回頂部按鈕深色主題 */
.position-fixed.btn-primary {
    background: linear-gradient(135deg, var(--warning-color), #ffdb4d) !important;
    border: none !important;
    color: var(--dark-color) !important;
    box-shadow: 0 4px 15px rgba(255,193,7,0.3);
}

/* 載入動畫深色主題 */
.loading {
    border-color: rgba(255,255,255,.3);
    border-top-color: var(--warning-color);
}