/* Shanganagh Concierge Widget Styles */

#shanganagh-concierge-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#shanganagh-concierge-widget.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

#shanganagh-concierge-widget.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* ── FAB Chat Button ─────────────────────────────────────────
   v4.2.2 · Avant Garde Web · 2026-03-24
   Uses the Shanganagh Castle crest more prominently, with a
   clean branded FAB and improved logo sizing.
──────────────────────────────────────────────────────────── */

/* Keyframe: gentle idle pulse — runs every 4s */
@keyframes shanganagh-fab-idle {
    0%   { transform: scale(1);    box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
    40%  { transform: scale(1.08); box-shadow: 0 8px 24px rgba(0,0,0,0.22); }
    55%  { transform: scale(1.04); box-shadow: 0 6px 18px rgba(0,0,0,0.18); }
    70%  { transform: scale(1.08); box-shadow: 0 8px 24px rgba(0,0,0,0.22); }
    100% { transform: scale(1);    box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
}

/* Keyframe: logo gentle bob */
@keyframes shanganagh-logo-rise {
    0%   { transform: translateY(0);    }
    40%  { transform: translateY(-4px); }
    60%  { transform: translateY(-2px); }
    80%  { transform: translateY(-4px); }
    100% { transform: translateY(0);    }
}

.shanganagh-chat-button {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid var(--shanganagh-primary, #2C5F2D);
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    animation: shanganagh-fab-idle 1.2s ease-in-out 1.5s 1;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}


/* Re-trigger attention animation every ~8s via delay trick */
.shanganagh-chat-button.shanganagh-fab-pulse {
    animation: shanganagh-fab-idle 1.2s ease-in-out;
}

.shanganagh-chat-button.shanganagh-fab-pulse .shanganagh-fab-logo-wrap {
    animation: shanganagh-logo-rise 1.2s ease-in-out;
}

.shanganagh-chat-button:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22) !important;
    border-color: var(--shanganagh-accent, #C9A961);
    animation: none;
}

/* Branded logo inset */
.shanganagh-fab-logo-wrap {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    padding: 0;
    box-sizing: border-box;
    animation: shanganagh-logo-rise 1.4s ease-in-out 2s 1;
    transition: transform 0.3s ease;
}

.shanganagh-chat-button:hover .shanganagh-fab-logo-wrap {
    animation: none;
    transform: scale(1.04);
    transition: transform 0.3s ease;
}


/* Logo image — contain preserves crest shape, never crops */
.shanganagh-fab-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.08));
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}

/* Chat Window */
.shanganagh-chat-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.position-bottom-right .shanganagh-chat-window {
    right: 0;
}

.position-bottom-left .shanganagh-chat-window {
    left: 0;
}

/* Header */
.shanganagh-chat-header {
    background: var(--shanganagh-primary, #2C5F2D);
    color: var(--shanganagh-header-text, white);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: white;
    padding: 4px;
}

.header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: inherit;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.9;
    color: inherit;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.close-button {
    background: transparent;
    border: none;
    color: var(--shanganagh-header-text, white);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Messages Container */
.shanganagh-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.shanganagh-messages::-webkit-scrollbar {
    width: 6px;
}

.shanganagh-messages::-webkit-scrollbar-track {
    background: transparent;
}

.shanganagh-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

/* Messages */
.message {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}

.message.user {
    display: flex;
    justify-content: flex-end;
}

.message.user .message-content {
    background: var(--shanganagh-user-bg, #2C5F2D);
    color: var(--shanganagh-user-text, white);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--shanganagh-assistant-bg, white);
    color: var(--shanganagh-assistant-text, #1F2937);
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.message--welcome .message-content {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border-bottom-left-radius: 12px;
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.shanganagh-quick-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 4px 0 18px;
}

.shanganagh-quick-link {
    appearance: none;
    border: 1px solid #d9e2ec;
    background: #ffffff;
    color: #334155;
    border-radius: 999px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.shanganagh-quick-link:hover,
.shanganagh-quick-link:focus {
    border-color: var(--shanganagh-primary, #2C5F2D);
    color: var(--shanganagh-primary, #2C5F2D);
    transform: translateY(-1px);
    outline: none;
}

.shanganagh-response-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 0;
    max-width: 80%;
}

.shanganagh-response-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid #d9e2ec;
    background: #ffffff;
    color: var(--shanganagh-primary, #2C5F2D);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.shanganagh-response-link:hover,
.shanganagh-response-link:focus {
    border-color: var(--shanganagh-primary, #2C5F2D);
    color: var(--shanganagh-primary, #2C5F2D);
    transform: translateY(-1px);
    outline: none;
}

/* Sponsor Cards */
.sponsor-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.sponsor-card {
    background: white;
    border: 1px solid var(--shanganagh-accent, #C9A961);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sponsor-card:hover {
    border-color: var(--shanganagh-primary, #2C5F2D);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sponsor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.sponsor-card-name {
    font-weight: 600;
    color: var(--shanganagh-primary, #2C5F2D);
    font-size: 14px;
}

.sponsor-card-category {
    font-size: 11px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sponsor-card-description {
    font-size: 13px;
    color: #4a5568;
    line-height: 1.4;
}

/* Input Area */
.shanganagh-input-area {
    border-top: 1px solid #e2e8f0;
    background: white;
}

.shanganagh-footer {
    padding: 8px 16px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    background: #f8f9fa;
}

.shanganagh-footer small {
    font-size: 11px;
    color: #718096;
    line-height: 1.4;
}

.shanganagh-footer a {
    color: var(--shanganagh-primary, #2C5F2D);
    text-decoration: none;
}

.shanganagh-footer a:hover {
    text-decoration: underline;
}

.input-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 16px;
}

#shanganagh-message-input {
    flex: 1;
    border: 1px solid #cbd5e0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}

#shanganagh-message-input:focus {
    border-color: var(--shanganagh-primary, #2C5F2D);
}

@keyframes shanganagh-send-cue {
    0%, 100% { transform: translateX(0) scale(1); box-shadow: 0 8px 16px rgba(44, 95, 45, 0.18); }
    18% { transform: translateX(-2px) scale(1.02); box-shadow: 0 10px 18px rgba(44, 95, 45, 0.22); }
    28% { transform: translateX(-5px) scale(1.03); box-shadow: 0 12px 20px rgba(44, 95, 45, 0.24); }
    40% { transform: translateX(-2px) scale(1.02); box-shadow: 0 10px 18px rgba(44, 95, 45, 0.22); }
}

@keyframes shanganagh-send-arrow-nudge {
    0%, 100% { transform: translateX(0); }
    18% { transform: translateX(-1px); }
    28% { transform: translateX(-3px); }
    40% { transform: translateX(-1px); }
}

.send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--shanganagh-primary, #2C5F2D);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 8px 16px rgba(44, 95, 45, 0.18);
    flex: 0 0 44px;
}

.send-button svg {
    display: block;
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    overflow: visible;
    color: #ffffff;
    flex: 0 0 22px;
}

.send-button svg path {
    vector-effect: non-scaling-stroke;
}

.send-button.send-button--cue {
    animation: shanganagh-send-cue 3.6s ease-in-out infinite;
}

.send-button.send-button--cue svg {
    animation: shanganagh-send-arrow-nudge 3.6s ease-in-out infinite;
}

.send-button:hover:not(:disabled),
.send-button.send-button--cue:hover:not(:disabled),
.send-button:focus-visible {
    animation: none;
}

.send-button:hover:not(:disabled) {
    background: var(--shanganagh-accent, #C9A961);
    transform: translateY(-1px) scale(1.03);
}

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

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--shanganagh-primary, #2C5F2D);
    animation: typing 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .shanganagh-chat-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        left: 0 !important;
        right: 0 !important;
        border-radius: 0;
    }

    .shanganagh-quick-links {
        gap: 8px;
    }

    .shanganagh-quick-link {
        font-size: 12px;
        padding: 10px 10px;
    }

    .shanganagh-response-links {
        max-width: 100%;
    }
    
    #shanganagh-concierge-widget.position-bottom-right,
    #shanganagh-concierge-widget.position-bottom-left {
        bottom: 20px;
        right: 20px;
        left: auto;
    }
}

/* Loading State */
.message.loading .message-content {
    background: #f1f1f1;
    color: #666;
    font-style: italic;
}

/* Error State */
.message.error .message-content {
    background: #fee;
    border-color: #fcc;
    color: #c33;
}

/* DART Times Card */
.dart-card {
    background: white;
    border: 2px solid var(--shanganagh-primary, #2C5F2D);
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
    max-width: 90%;
}

.dart-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.dart-icon {
    font-size: 28px;
}

.dart-route {
    flex: 1;
}

.dart-route strong {
    font-size: 16px;
    color: var(--shanganagh-primary, #2C5F2D);
}

.journey-time {
    font-size: 13px;
    color: #718096;
}

.dart-times {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dart-time-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.dart-time-row .time {
    font-weight: 600;
    font-size: 15px;
    color: var(--shanganagh-primary, #2C5F2D);
}

.dart-time-row .due-in {
    font-size: 14px;
    color: #4a5568;
}

.dart-time-row .status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    background: #d4edda;
    color: #155724;
}

.dart-time-row .status.delayed {
    background: #f8d7da;
    color: #721c24;
}

.dart-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.dart-footer a {
    color: var(--shanganagh-primary, #2C5F2D);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.dart-footer a:hover {
    text-decoration: underline;
}

.dart-card.error {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    #shanganagh-concierge-widget.position-bottom-right {
        bottom: 0;
        right: 0;
        left: 0;
    }
    
    #shanganagh-concierge-widget.position-bottom-left {
        bottom: 0;
        left: 0;
        right: 0;
    }
    
    .shanganagh-chat-button {
        position: fixed;
        bottom: 15px;
        right: 15px;
        z-index: 999999;
    }
    
    .shanganagh-chat-window {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }
    
    .shanganagh-chat-header {
        border-radius: 0 !important;
    }
    
    .shanganagh-messages {
        height: calc(100vh - 160px) !important;
    }
    
    .shanganagh-input-area {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    /* Make sponsor cards stack on mobile */
    .sponsor-cards {
        flex-direction: column;
    }
    
    .sponsor-card {
        max-width: 100% !important;
    }
    
    /* DART card mobile optimization */
    .dart-card {
        max-width: 100%;
    }
    
    .dart-time-row {
        flex-wrap: wrap;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .shanganagh-chat-button {
        width: 56px;
        height: 56px;
        bottom: 12px;
        right: 12px;
    }
    
    .shanganagh-chat-button svg {
        width: 24px;
        height: 24px;
    }
    
    .shanganagh-chat-header {
        padding: 12px 16px;
    }
    
    .header-logo {
        width: 36px;
        height: 36px;
    }
    
    .header-text h3 {
        font-size: 16px;
    }
    
    .status-indicator {
        font-size: 12px;
    }
    
    .message-content {
        font-size: 15px;
    }
    
    .input-container {
        padding: 12px;
    }
    
    #shanganagh-message-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}
