/**
 * Tutkia Plugin Styles - COMPLETELY REBUILT
 */

/* Main Container - Simple Block Layout */
#tutkia-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: var(--tutkia-font-size, 14px);
    background: var(--tutkia-primary-bg, #ffffff);
}

#tutkia-container * {
    box-sizing: border-box;
}

/* Header Section */
.tutkia-header-section {
    background: var(--tutkia-accent-bg, #f8f9fa);
    border: 1px solid var(--tutkia-border, #dddddd);
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.tutkia-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--tutkia-primary-color, #007cba);
    color: white;
}

.tutkia-main-header h3 {
    margin: 0;
    font-size: 18px;
    color: white;
    font-weight: 600;
}

.tutkia-trip-settings {
    color: white;
    font-size: 16px;
}

.tutkia-sentence-input {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tutkia-inline-select {
    display: inline-block;
    padding: 6px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tutkia-inline-select:hover,
.tutkia-inline-select:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    outline: none;
}

.tutkia-inline-select option {
    background: #34495e;
    color: white;
}

.tutkia-inline-input {
    display: inline-block;
    width: 60px;
    padding: 6px 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
}

.tutkia-inline-input:hover,
.tutkia-inline-input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    outline: none;
}

/* Add subtle glow effect to focused elements */
.tutkia-inline-select:focus,
.tutkia-inline-input:focus {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

#tutkia-day-text {
    font-weight: 500;
}

.tutkia-welcome-message {
    padding: 20px;
    background: var(--tutkia-primary-bg, #ffffff);
    color: var(--tutkia-text-color, #333333);
    line-height: 1.5;
    border-top: 1px solid var(--tutkia-border, #dddddd);
}

/* Chat Section */
.tutkia-chat-section {
    background: var(--tutkia-primary-bg, #ffffff);
    border: 2px solid var(--tutkia-primary-color, #3498db);
    margin: 20px;
    border-radius: 8px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.tutkia-chat-messages {
    flex: 1;
    padding: 20px;
    background: var(--tutkia-accent-bg, #f8f9fa);
    min-height: 300px;
    overflow-y: auto;
}

.tutkia-chat-input {
    padding: 15px 20px;
    background: var(--tutkia-primary-bg, #ffffff);
    border-top: 1px solid #e9ecef;
}

#tutkia-chat-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

#tutkia-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ced4da;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
}

#tutkia-input:focus {
    border-color: var(--tutkia-primary-color, #3498db);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.tutkia-send-btn {
    padding: 12px 20px;
    background: var(--tutkia-primary-color, #3498db);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.tutkia-send-btn:hover {
    background: #2980b9;
}

/* Map Section */
.tutkia-map-section {
    background: var(--tutkia-primary-bg, #ffffff);
    border: 1px solid #dee2e6;
    margin: 20px;
    border-radius: 8px;
    min-height: 600px;
}

.tutkia-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--tutkia-accent-bg, #f8f9fa);
    border-bottom: 1px solid #dee2e6;
}

.tutkia-map-header h4 {
    margin: 0;
    font-size: 16px;
    color: #495057;
}


#tutkia-map {
    height: 500px;
    width: 100%;
    border-radius: 0 0 8px 8px;
}

/* Base Location Editor */
.tutkia-base-location-editor {
    padding: 15px 20px;
    background: var(--tutkia-accent-bg, #f8f9fa);
    border-top: 1px solid #dee2e6;
}

.tutkia-location-display {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tutkia-location-display strong {
    color: #495057;
}

#tutkia-current-base-location {
    color: var(--tutkia-primary-color, #007cba);
    font-weight: 500;
}

.tutkia-location-editor {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#tutkia-new-base-location {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

#tutkia-new-base-location:focus {
    border-color: var(--tutkia-primary-color, #007cba);
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
    outline: none;
}

/* Itinerary Section */
.tutkia-itinerary-section {
    background: var(--tutkia-primary-bg, #ffffff);
    border: 1px solid #dee2e6;
    margin: 20px;
    margin-top: 0;
    border-radius: 8px;
    min-height: 400px;
}

.tutkia-itinerary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--tutkia-accent-bg, #f8f9fa);
    border-bottom: 1px solid #dee2e6;
}

.tutkia-itinerary-header h4 {
    margin: 0;
    font-size: 16px;
    color: #495057;
}

.tutkia-itinerary-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tutkia-itinerary-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #6c757d;
}

.tutkia-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--tutkia-primary-color, #007cba);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tutkia-action-btn:hover {
    background: var(--tutkia-primary-hover, #005a87);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tutkia-action-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.tutkia-action-btn svg {
    flex-shrink: 0;
}

.tutkia-itinerary-content {
    padding: 20px;
    min-height: 300px;
}

/* Chat Messages */
.tutkia-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tutkia-message {
    display: flex;
    margin-bottom: 8px;
}

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

.tutkia-bot-message {
    justify-content: flex-start;
}

.tutkia-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
}

.tutkia-user-message .tutkia-message-content {
    background: var(--tutkia-user-message-bg, #3498db);
    color: var(--tutkia-user-message-color, white);
    border-bottom-right-radius: 4px;
}

.tutkia-bot-message .tutkia-message-content {
    background: var(--tutkia-bot-message-bg, #e9ecef);
    color: var(--tutkia-bot-message-color, #495057);
    border-bottom-left-radius: 4px;
}

/* Location Items */
.tutkia-locations-list {
    margin: 0;
    padding: 0;
}

.tutkia-location-item {
    padding: 15px;
    margin-bottom: 10px;
    background: var(--tutkia-accent-bg, #f8f9fa);
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.tutkia-location-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 12px;
}

.tutkia-location-number {
    background: #007cba !important;
    color: white !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    flex-shrink: 0 !important;
    margin-top: 2px !important;
    min-width: 24px !important;
    min-height: 24px !important;
}

.tutkia-location-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.tutkia-location-name {
    font-weight: 600;
    color: #495057;
    margin: 0;
    font-size: 14px;
}

.tutkia-location-type {
    font-size: 11px;
    padding: 2px 6px;
    background: var(--tutkia-primary-color, #3498db);
    color: white;
    border-radius: 10px;
    text-transform: uppercase;
}

.tutkia-location-address {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
    font-style: italic;
}

.tutkia-location-address[data-address-placeholder="true"] {
    opacity: 0.6;
}

.tutkia-location-address .address-text {
    margin-left: 2px;
}

.tutkia-location-travel {
    margin-bottom: 8px;
    font-size: 12px;
    color: #6c757d;
}

.tutkia-travel-base,
.tutkia-travel-sequential {
    margin-bottom: 2px;
    font-style: italic;
}

.tutkia-travel-base {
    color: #28a745;
}

.tutkia-travel-sequential {
    color: #fd7e14;
}

.tutkia-location-contact {
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

@media (max-width: 600px) {
    .tutkia-location-contact {
        flex-direction: column;
        gap: 4px;
    }
}

.tutkia-location-phone,
.tutkia-location-website {
    font-size: 12px;
    color: #6c757d;
}

.tutkia-location-phone a,
.tutkia-location-website a {
    color: #007cba !important;
    text-decoration: underline !important;
    margin-left: 2px;
    font-weight: 500 !important;
}

.tutkia-location-phone a:hover,
.tutkia-location-website a:hover {
    color: #005a87 !important;
    text-decoration: underline !important;
}

.tutkia-location-phone a:focus,
.tutkia-location-website a:focus {
    outline: 2px solid var(--tutkia-primary-color, #007cba);
    outline-offset: 2px;
    border-radius: 2px;
}

.tutkia-location-description {
    font-size: 13px;
    color: #6c757d;
    margin: 5px 0;
    line-height: 1.4;
}

.tutkia-location-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.tutkia-location-duration {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

.tutkia-remove-location {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
}

.tutkia-remove-location:hover {
    background: #c82333;
}

/* Modal */
.tutkia-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.tutkia-modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
}

.tutkia-modal-content h3 {
    margin: 0 0 20px 0;
}

.tutkia-modal-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.tutkia-modal-content input {
    width: 100%;
    padding: 8px;
    margin-bottom: 20px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.tutkia-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Loading Animation */
.tutkia-loading-message .tutkia-message-content {
    background: var(--tutkia-bot-message-bg, #e9ecef);
    border: 1px solid #dee2e6;
    padding: 16px 20px;
}

.tutkia-loading {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tutkia-loading::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tutkia-primary-color, #3498db);
    animation: tutkia-typing 1.4s infinite ease-in-out both;
}

.tutkia-loading::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tutkia-primary-color, #3498db);
    animation: tutkia-typing 1.4s -0.32s infinite ease-in-out both;
    margin-right: 4px;
}

@keyframes tutkia-typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .tutkia-main-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .tutkia-trip-settings {
        font-size: 14px;
    }
    
    .tutkia-sentence-input {
        gap: 6px;
    }
    
    .tutkia-inline-select,
    .tutkia-inline-input {
        font-size: 14px;
        padding: 4px 8px;
    }
    
    .tutkia-message-content {
        max-width: 85%;
    }
    
    .tutkia-chat-section,
    .tutkia-map-section,
    .tutkia-itinerary-section {
        margin: 10px;
    }
    
    .tutkia-itinerary-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .tutkia-itinerary-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .tutkia-action-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Legal Notice Section */
.tutkia-legal-notice {
    text-align: center;
    padding: 15px 0;
    background: var(--tutkia-accent-bg, #f8f9fa);
    border-top: 1px solid var(--tutkia-border, #dddddd);
    margin-top: 20px;
    border-radius: 0 0 8px 8px;
}

.tutkia-legal-links {
    font-size: 12px;
    color: var(--tutkia-text, #333333);
}

.tutkia-legal-link {
    color: var(--tutkia-primary-color, #007cba);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.tutkia-legal-link:hover {
    color: var(--tutkia-accent-color, #005a87);
    text-decoration: none;
}

.tutkia-legal-separator {
    margin: 0 10px;
    color: var(--tutkia-muted, #888888);
}

/* Modal Styles */
.tutkia-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tutkia-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: tutkiaModalFadeIn 0.3s ease;
}

.tutkia-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--tutkia-primary-color, #007cba);
    color: white;
}

.tutkia-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.tutkia-modal-close {
    font-size: 24px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.tutkia-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.tutkia-modal-body {
    padding: 20px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

.tutkia-modal-body h2,
.tutkia-modal-body h3,
.tutkia-modal-body h4 {
    color: var(--tutkia-primary-color, #007cba);
    margin-top: 20px;
    margin-bottom: 10px;
}

.tutkia-modal-body h2:first-child,
.tutkia-modal-body h3:first-child,
.tutkia-modal-body h4:first-child {
    margin-top: 0;
}

.tutkia-modal-body p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: var(--tutkia-text, #333333);
}

.tutkia-modal-body ul,
.tutkia-modal-body ol {
    margin-bottom: 15px;
    padding-left: 20px;
}

.tutkia-modal-body li {
    margin-bottom: 5px;
    line-height: 1.6;
}

@keyframes tutkiaModalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile responsive for modals */
@media (max-width: 768px) {
    .tutkia-modal {
        padding: 10px;
    }
    
    .tutkia-modal-content {
        max-height: 95vh;
    }
    
    .tutkia-modal-header {
        padding: 15px;
    }
    
    .tutkia-modal-header h3 {
        font-size: 16px;
    }
    
    .tutkia-modal-body {
        padding: 15px;
        max-height: calc(95vh - 70px);
    }
    
    .tutkia-legal-notice {
        padding: 12px 0;
        margin-top: 15px;
    }
    
    .tutkia-legal-links {
        font-size: 11px;
    }
    
    .tutkia-legal-separator {
        margin: 0 8px;
    }
}