/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
}

h1 {
    color: #222;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2.5rem;
    font-weight: 300;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
}

.status {
    text-align: center;
    margin: 20px 0;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 15px;
    border-radius: 10px;
    background: #f1f1f1;
    border: 2px solid #e0e0e0;
    color: #222;
    transition: all 0.3s ease;
}

.conversation {
    margin: 30px 0;
    padding: 20px;
    height: 400px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    overflow-y: auto;
    background: #fafafa;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.03);
    scrollbar-width: thin;
    scrollbar-color: #bdbdbd transparent;
}

.conversation::-webkit-scrollbar {
    width: 6px;
}

.conversation::-webkit-scrollbar-track {
    background: transparent;
}

.conversation::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 3px;
}

.message {
    margin: 15px 0;
    padding: 15px 20px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    animation: slideIn 0.3s ease-out;
}

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

.message.user {
    background: #222;
    color: #fff;
    margin-left: auto;
    text-align: right;
    border-bottom-right-radius: 5px;
}

.message.assistant {
    background: #e0e0e0;
    color: #222;
    margin-right: auto;
    text-align: left;
    border-bottom-left-radius: 5px;
}

.message.system {
    background: #bdbdbd;
    color: #fff;
    text-align: center;
    font-style: italic;
    margin: 10px auto;
    max-width: 60%;
    font-size: 0.9rem;
    border-radius: 25px;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.07), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: #222;
    color: #fff;
    min-width: 160px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.13);
}

.btn-secondary {
    background: #bdbdbd;
    color: #222;
    min-width: 160px;
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.12);
}

.btn-modify {
    background: #FF9800;
    color: white;
    margin-top: 15px;
    width: 100%;
    font-size: 0.9rem;
    padding: 12px 20px;
}

.btn-modify:hover:not(:disabled) {
    background: #F57C00;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 152, 0, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn:active {
    transform: scale(0.95);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 20px;
        border-radius: 15px;
    }

    h1 {
        font-size: 2rem;
    }

    .conversation {
        height: 300px;
        margin: 20px 0;
    }

    .message {
        max-width: 90%;
        padding: 12px 16px;
    }

    .controls {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .btn {
        width: 100%;
        max-width: 250px;
        padding: 12px 25px;
        font-size: 1rem;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-radius: 50%;
    border-top-color: #222;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Status variations */
.status.connected {
    background: #e0f7e9;
    border-color: #b7e4c7;
    color: #222;
}

.status.listening {
    background: #fff3f3;
    border-color: #ffe1e1;
    color: #222;
    animation: pulse 2s infinite;
}

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

.status.error {
    background: #fceaea;
    border-color: #f5bebe;
    color: #b71c1c;
}

/* Reservation confirmation styles */
.reservation-confirmation {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    border: none;
}

.reservation-confirmation h3 {
    margin: 0 0 15px 0;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    color: white;
}

.reservation-details {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    backdrop-filter: blur(10px);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    flex: 1;
}

.detail-row .value {
    font-weight: 500;
    color: white;
    flex: 1;
    text-align: right;
    word-break: break-word;
}

.status-reserved {
    background: #2E7D32;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.status-pending {
    background: #F57C00;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.status-cancelled {
    background: #D32F2F;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

/* Reservation update styles */
.reservation-update {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    border: none;
    animation: slideInUp 0.5s ease-out;
}

.reservation-update h3 {
    margin: 0 0 15px 0;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    color: white;
}

/* Animation for reservation confirmation and update */
.reservation-confirmation,
.reservation-update {
    animation: slideInUp 0.5s ease-out;
}

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

/* Restaurant Configuration Styles */
.restaurant-config {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.restaurant-config h3 {
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
}

.config-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.form-group label {
    font-weight: 600;
    min-width: 150px;
    font-size: 0.95rem;
}

.form-group input {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.form-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn-config {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px);
}

.btn-config:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: translateY(-2px);
}

.form-hint {
    font-size: 0.85rem;
    opacity: 0.8;
    font-style: italic;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.restaurant-status {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.restaurant-status.success {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
    color: #e8f5e8;
}

.restaurant-status.error {
    background: rgba(244, 67, 54, 0.3);
    border-color: rgba(244, 67, 54, 0.5);
    color: #ffebee;
}

.restaurant-status.loading {
    background: rgba(255, 193, 7, 0.3);
    border-color: rgba(255, 193, 7, 0.5);
    color: #fffde7;
}

/* Restaurant Info Display */
.restaurant-info {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-radius: 15px;
    padding: 25px;
    margin-top: 30px;
    color: white;
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.3);
}

.restaurant-info h3 {
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
}

.restaurant-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.restaurant-detail-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.restaurant-detail-item strong {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.restaurant-detail-item span {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Responsive design for restaurant configuration */
@media (max-width: 768px) {
    .form-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-group label {
        min-width: unset;
        margin-bottom: 5px;
    }
    
    .form-group input {
        min-width: unset;
    }
    
    .restaurant-details {
        grid-template-columns: 1fr;
    }
}

/* Responsive design for reservation details */
/* API Testing Section */
.api-testing {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.api-testing h3 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-align: center;
}

.test-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.btn-test {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-test:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-test:active {
    transform: translateY(0);
}

.api-results {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    min-height: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.api-results:empty::before {
    content: "Test results will appear here...";
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

.api-result-item {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    border-left: 4px solid #667eea;
}

.api-result-item.success {
    border-left-color: #27AE60;
    background: rgba(39, 174, 96, 0.1);
}

.api-result-item.error {
    border-left-color: #E74C3C;
    background: rgba(231, 76, 60, 0.1);
}

@media (max-width: 480px) {
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .detail-row .value {
        text-align: left;
    }
    
    .reservation-confirmation {
        padding: 15px;
        margin: 10px 0;
    }
    
    .restaurant-config,
    .restaurant-info,
    .api-testing {
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
    }

    .test-buttons {
        flex-direction: column;
    }

    .btn-test {
        width: 100%;
    }
}

/* Availability Testing Styles */
.availability-testing {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.availability-testing h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 600;
}

.availability-form {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 150px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #34495e;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    transform: scale(1.2);
}

.availability-results {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    min-height: 50px;
    max-height: 500px;
    overflow-y: auto;
}

.availability-results:empty::before {
    content: "Availability results will appear here...";
    color: #6c757d;
    font-style: italic;
}

.availability-summary {
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.availability-summary h4 {
    color: #0066cc;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.table-recommendation {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.table-recommendation h5 {
    color: #155724;
    margin-bottom: 8px;
    font-size: 1rem;
}

.table-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.table-detail-item {
    background: #ffffff;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.table-detail-item strong {
    color: #2c3e50;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        min-width: 100%;
    }
    
    .availability-testing, .extraction-testing {
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
    }
    
    .table-details {
        grid-template-columns: 1fr;
    }
}

/* AI Extraction Testing Styles */
.extraction-testing {
    background: #f8f9ff;
    border: 2px solid #e3e6ff;
    border-radius: 15px;
    padding: 20px;
    margin: 30px 0;
}

.extraction-testing h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.extraction-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.extraction-form textarea {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border: 2px solid #e0e4e7;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.3s ease;
}

.extraction-form textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.extraction-results {
    margin-top: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.extraction-summary {
    background: #f0f9ff;
    border: 2px solid #bae6fd;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.extraction-summary h4 {
    color: #0369a1;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.extracted-data {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.extracted-data .table-detail-item {
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 6px;
}

.extracted-data .table-detail-item:last-child {
    margin-bottom: 0;
}

.api-result-item.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.api-result-item.warning {
    background: #fffbeb;
    border-color: #fed7aa;
}

.api-result-item.error {
    background: #fef2f2;
    border-color: #fecaca;
}

.api-result-item h4 {
    margin-bottom: 10px;
}

.api-result-item.success h4 {
    color: #166534;
}

.api-result-item.warning h4 {
    color: #d97706;
}

.api-result-item.error h4 {
    color: #dc2626;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    font-style: italic;
}

.result-data {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}