/* Base Styles */
body {
    font-family: "SF Pro Rounded", "Nunito", "PingFang TC", "Noto Sans TC", "Hiragino Maru Gothic ProN", "Segoe UI Rounded", "Arial Rounded MT Bold", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}

/* Utility Classes */
.hidden { 
    display: none; 
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.collapsible-content.expanded {
    max-height: 4000px;
}

/* Dialog Styles */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.dialog-content {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    max-width: 28rem;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.collapsible-content.expanded {
    max-height: 4000px;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-destructive {
    background-color: rgb(239 68 68);
    color: white;
}

.badge-success {
    background-color: rgb(34 197 94);
    color: white;
}

.badge-blue {
    background-color: rgb(59 130 246);
    color: white;
}

.badge-orange {
    background-color: rgb(249 115 22);
    color: white;
}

.badge-green {
    background-color: rgb(34 197 94);
    color: white;
}

.btn-green {
    background-color: rgb(34 197 94);
    color: white;
    border: 1px solid rgb(34 197 94);
}

.btn-green:hover {
    background-color: rgb(21 163 74);
    border-color: rgb(21 163 74);
}

.btn-yellow {
    background-color: #ebbd34;
    color: white;
    border: 1px solid #ebbd34;
}

.btn-yellow:hover {
    background-color: #d4a824;
    border-color: #d4a824;
}

.badge-secondary {
    background-color: rgb(243 244 246);
    color: rgb(55 65 81);
}

.badge-outline {
    border: 1px solid rgb(36, 36, 36);
    background-color: transparent;
}

.btn-primary {
    background-color: rgb(59 130 246);
    color: white;
}

.btn-primary:hover {
    background-color: rgb(37 99 235);
}

.btn-outline {
    border: 1px solid #fbf9f9;
    background-color: #fbf9f9;
}

.btn-outline:hover {
    background-color: rgb(243 244 246);
}

/* red button helper (match badge-destructive hue) */
.btn-red {
    background-color: rgb(239 68 68);
    color: white;
    border: 1px solid rgb(239 68 68);
}
.btn-red:hover {
    background-color: rgb(220 38 38);
    border-color: rgb(220 38 38);
}

/* Dashboard filter button active state */
.dashboard-filter-btn.active {
    background-color: rgb(59 130 246);
    color: white;
    border-color: rgb(59 130 246);
}

.dashboard-filter-btn.active:hover {
    background-color: rgb(37 99 235);
    border-color: rgb(37 99 235);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:not(:disabled) {
    pointer-events: auto;
    position: relative;
    z-index: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* WhatsApp Button Styles */
button.btn.btn-whatsapp,
#whatsappHelpBtn,
#cancelWhatsappHelpBtn {
    background-color: #25D366;
    color: white;
    border: 1px solid #25D366;
}

button.btn.btn-whatsapp:hover,
#whatsappHelpBtn:hover,
#cancelWhatsappHelpBtn:hover {
    background-color: #128C7E;
    border-color: #128C7E;
}

/* Button Base Styles - 按钮基础样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Small Button Styles - 小按钮专用样式 */
.btn.btn-small {
    min-height: 25px;
    min-width: 25px;
    font-size: 0.7rem;
    line-height: 1;
}

.card {
    background: #f4edcd;
    border: 1px solid #f4edcd;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    position: relative; /* enable watermark positioning */
    overflow: hidden; /* clip watermark within card */
}

.provider-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    padding-right: 5rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    margin-bottom: 1.25rem;
    position: relative;
}

.provider-meta {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.provider-avatar-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 999px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.8);
    background: #fff;
    overflow: hidden;
    flex-shrink: 0;
}

.provider-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(var(--provider-scale, 1));
    transform-origin: center;
}

.provider-label {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: #6b7280;
    margin-bottom: 0.15rem;
}

.provider-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.provider-note {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0.1rem 0 0;
}

.provider-status-stack {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.provider-capacity-chip {
    background: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.75rem;
    color: #111827;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.08);
    min-width: 70px;
    text-align: center;
}

.provider-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    margin-top: 0.35rem;
    background: rgba(6, 122, 104, 0.1);
    color: #03624f;
    font-weight: 600;
}

@media (max-width: 640px) {
    .provider-row {
        align-items: flex-start;
        padding-right: 4rem;
    }

    .provider-status-stack {
        position: absolute;
        top: 0.25rem;
        right: 0.25rem;
    }
}

/* Watermark for all cards - multiple selectors for compatibility */
.card::after {
    content: "";
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 250px;
    background-image: url('img/logo.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.03;
    pointer-events: none;
    z-index: 1;
}

/* Fallback for older browsers */
.card:after {
    content: "";
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 250px;
    background-image: url('img/logo.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.03;
    pointer-events: none;
    z-index: 1;
}

/* Force watermark with higher specificity */
div.card::after {
    content: "";
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 250px;
    background-image: url('img/logo.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.03;
    pointer-events: none;
    z-index: 9999;
}

/* Special Location Card Styles */
.card.card-location-tuen-mun {
    background: rgba(255, 165, 0, 0.3); /* 淺橙色背景，30%透明度 */
    border: 1px solid rgba(255, 165, 0, 0.6); /* 邊框也添加透明度 */
}

.card.card-location-tv-tower {
    background: rgba(147, 51, 234, 0.3); /* 紫色背景，30%透明度 */
    border: 1px solid rgba(147, 51, 234, 0.7); /* 邊框也添加透明度 */
}

.card.card-location-san-po-kong {
    background: rgba(198, 88, 113, 0.3); /* #c65871 背景，30%透明度 */
    border: 1px solid rgba(198, 88, 113, 0.6); /* 邊框添加透明度 */
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgb(209 213 219);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.input:focus {
    outline: none;
    border-color: rgb(59 130 246);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Help tooltip styles */
.help-tooltip {
    pointer-events: none;
    display: none;
}

.help-tooltip.opacity-100 {
    display: block;
    z-index: 50;
}

/* Desktop hover support */
@media (hover: hover) {
    .help-tooltip {
        pointer-events: none;
    }
}

/* Mobile touch support */
@media (hover: none) {
    .help-tooltip {
        pointer-events: none;
    }
    
    /* 主要按钮在移动端保持44px最小尺寸 */
    .btn:not(.btn-small) {
        min-height: 25px;
        min-width: 25px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* 小按钮在移动端保持小尺寸 */
    .btn.btn-small {
        min-height: 25px;
        min-width: 25px;
        font-size: 0.7rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

/* Calendar Styles */
.calendar-wrapper {
    font-family: "SF Pro Rounded", "Nunito", "PingFang TC", "Noto Sans TC", "Hiragino Maru Gothic ProN", "Segoe UI Rounded", "Arial Rounded MT Bold", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
    display: block;
}

.calendar-header {
    border-radius: 0.5rem 0.5rem 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 60px;
}

.calendar-header h3 {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.calendar-header button {
    display: inline-flex;
    visibility: visible;
    opacity: 1;
}

.calendar-grid {
    background: white;
    display: block;
}

.calendar-week {
    min-height: 120px;
}

/* Carousel styles */
.calendar-carousel {
    position: relative;
}
.calendar-carousel .carousel-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 85%;
    gap: 1rem;
    overflow-x: auto;
    padding: 0.5rem 2.5rem; /* room for arrows */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 640px) {
    .calendar-carousel .carousel-track { grid-auto-columns: 45%; }
}
@media (min-width: 1024px) {
    .calendar-carousel .carousel-track { grid-auto-columns: 30%; }
}
.calendar-carousel .carousel-card {
    scroll-snap-align: center;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    transform: scale(0.92);
    transition: transform .2s ease, box-shadow .2s ease;
}
.calendar-carousel .carousel-card.is-center {
    transform: scale(1);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}
.calendar-carousel .carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    background: rgba(255,255,255,0.9);
    border: 1px solid #e5e7eb;
    display: grid;
    place-items: center;
    z-index: 10;
}
.calendar-carousel .carousel-btn.prev { left: 8px; }
.calendar-carousel .carousel-btn.next { right: 8px; }

.calendar-day {
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
    background: white;
}

.calendar-day:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.calendar-day-today {
    background-color: #f0fdf4;
    border-color: #22c55e;
    border-width: 2px;
}

.calendar-day-today .day-header .text-lg {
    color: #16a34a;
}

.day-header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.day-events {
    max-height: 80px;
    overflow-y: auto;
}

.event-item {
    margin-bottom: 0.25rem;
}

.event-item:last-child {
    margin-bottom: 0;
}

/* 移動端日曆樣式 */
.calendar-mobile-container {
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.calendar-mobile-day {
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
    background: white;
}

.calendar-mobile-day:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.calendar-mobile-day-today {
    background-color: #f0fdf4;
    border-color: #22c55e;
    border-width: 2px;
}

.calendar-mobile-day-today .text-xl {
    color: #16a34a;
}

.day-events-mobile {
    max-height: 60px;
    overflow-y: auto;
}

.event-item-mobile {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
}

.event-item-mobile:last-child {
    margin-bottom: 0;
}

.event-item-mobile:hover {
    background-color: #f3f4f6;
}

.event-item-mobile:active {
    background-color: #e5e7eb;
    transform: scale(0.98);
}

/* 移動端按鈕優化 */
@media (max-width: 768px) {
    .event-item-mobile {
        min-height: 25px;
        min-width: 25px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    .calendar-week {
        grid-template-columns: repeat(7, 1fr);
        gap: 0.25rem;
    }
    
    .calendar-day {
        padding: 0.5rem;
        min-height: 100px;
    }
    
    .day-header .text-lg {
        font-size: 1rem;
    }
    
    .day-header .text-xs {
        font-size: 0.625rem;
    }
    
    .event-item {
        font-size: 0.625rem;
    }
    
    /* 移動端隱藏桌面版日曆網格 */
    .calendar-wrapper .calendar-week {
        display: none;
    }
    
    .calendar-wrapper .calendar-mobile-container {
        display: block;
    }
}

/* Responsive Design - Desktop */
@media (min-width: 769px) {
    /* 桌面端隱藏移動版日曆 */
    .calendar-wrapper .calendar-mobile-container {
        display: none;
    }
    
    .calendar-wrapper .calendar-week {
        display: grid;
    }
    
    /* 確保桌面端標題和控制按鈕正常顯示 */
    .calendar-wrapper .calendar-header {
        display: flex;
    }
    
    .calendar-wrapper .calendar-grid {
        display: block;
    }
    
    .calendar-wrapper {
        display: block;
    }
}

@media (max-width: 480px) {
    .calendar-mobile-day {
        padding: 0.75rem;
    }
    
    .calendar-mobile-day .text-xl {
        font-size: 1.125rem;
    }
    
    .calendar-mobile-day .text-sm {
        font-size: 0.75rem;
    }
    
    .calendar-mobile-day .text-xs {
        font-size: 0.625rem;
    }
    
    .event-item-mobile {
        font-size: 0.75rem;
        padding: 0.375rem;
    }
    
    .day-events-mobile {
        max-height: 50px;
    }
}