* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #0d0620 0%, #1a0f3d 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.container {
    background: #1a1535;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 1200px;
    width: 100%;
    padding: 40px;
    border: 1px solid #2a1f4d;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 40px);
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #c96969;
    position: relative;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-main {
    text-align: center;
}

.user-profile {
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    background: rgba(42, 31, 77, 0.3);
    border-radius: 8px;
    border: 1px solid #2a1f4d;
}

.user-name {
    color: #b8b5c9;
    font-size: 14px;
    font-weight: 500;
}

.auth-btn {
    background: #c96969;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.auth-btn:hover {
    background: #d97e7e;
}

.auth-btn:active {
    transform: translateY(1px);
}

.logo {
    width: 85px;
    height: auto;
    margin: 0 auto 10px;
    display: block;
}

h1 {
    color: #e8e6f0;
    margin-bottom: 10px;
    font-size: 1.25em;
}

h2 {
    color: #c96969;
    margin-bottom: 20px;
}

header p {
    color: #b8b5c9;
    font-size: 1.2em;
}

main {
    margin-bottom: 40px;
}

section {
    margin-bottom: 30px;
}

.msisdn-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.filter-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    padding: 15px;
    background: rgba(42, 31, 77, 0.3);
    border-radius: 8px;
    border: 1px solid #2a1f4d;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #0f0a24;
    border: 1px solid #c96969;
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #2a1f4d;
    transition: background 0.2s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: rgba(201, 105, 105, 0.1);
}

.autocomplete-main {
    color: #e8e6f0;
    font-size: 15px;
    font-weight: 500;
}

.form-group label {
    color: #b8b5c9;
    font-size: 14px;
    font-weight: 500;
}

.form-input {
    background: #0f0a24;
    border: 1px solid #2a1f4d;
    border-radius: 5px;
    padding: 12px 15px;
    color: #e8e6f0;
    font-size: 16px;
    transition: border-color 0.3s ease;
    width: 100%;
}

.form-input[type="datetime-local"] {
    cursor: pointer;
    color-scheme: dark;
}

.form-input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.form-input[type="number"]::-webkit-inner-spin-button,
.form-input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

.form-input:focus {
    outline: none;
    border-color: #c96969;
}

.form-input.invalid {
    border-color: #ff6b7a;
}

.form-input::placeholder {
    color: #5a5570;
}

.error-message {
    color: #ff6b7a;
    font-size: 13px;
    min-height: 18px;
    display: none;
}

.error-message.show {
    display: block;
}

.inspect-btn {
    background: #c96969;
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 10px;
}

.inspect-btn:hover {
    background: #d97e7e;
}

.inspect-btn:active {
    transform: translateY(1px);
}

.inspect-btn:disabled {
    background: #5a5570;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Chat Container Styles */
.chat-container {
    margin-top: 30px;
    background: #0f0a24;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #2a1f4d;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.chat-header {
    background: #1a1535;
    padding: 15px 20px;
    border-bottom: 1px solid #2a1f4d;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    color: #e8e6f0;
    font-size: 18px;
    margin: 0;
}

.message-count {
    color: #b8b5c9;
    font-size: 13px;
}

.chat-messages {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
}

/* WhatsApp-style message bubbles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    animation: fadeIn 0.3s ease-in;
}

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

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.message-role {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 3px;
}

.message.user .message-role {
    background: #c96969;
    color: white;
}

.message.assistant .message-role {
    background: #4a4560;
    color: #e8e6f0;
}

.message-timestamp {
    font-size: 11px;
    color: #7a7590;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 8px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message.user .message-bubble {
    background: #c96969;
    color: white;
    border-bottom-right-radius: 2px;
}

.message.assistant .message-bubble {
    background: #2a1f4d;
    color: #e8e6f0;
    border-bottom-left-radius: 2px;
}

.message-content {
    font-size: 14px;
    white-space: pre-wrap;
}

.message-content a {
    color: inherit;
    text-decoration: underline;
    word-break: break-all;
}

.message.user .message-content a {
    color: white;
}

.message.assistant .message-content a {
    color: #9fc9ff;
}

.message-content a:hover {
    opacity: 0.8;
}

/* Loading spinner */
.loading-messages {
    text-align: center;
    padding: 40px;
    color: #b8b5c9;
}

.spinner {
    border: 3px solid #2a1f4d;
    border-top: 3px solid #c96969;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #0f0a24;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #2a1f4d;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #3a2f5d;
}

/* Alert Container */
.alert-container {
    margin-top: 20px;
    animation: slideDown 0.3s ease-out;
}

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

.alert-message {
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-message.error {
    background: rgba(255, 107, 122, 0.15);
    border: 1px solid #ff6b7a;
    color: #ff6b7a;
}

.alert-message.info {
    background: rgba(201, 105, 105, 0.15);
    border: 1px solid #c96969;
    color: #e8e6f0;
}

.alert-message.warning {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid #ffc107;
    color: #ffc107;
}

.api-demo {
    background: #0f0a24;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #2a1f4d;
}

button {
    background: #c96969;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

button:hover {
    background: #d97e7e;
}

button:active {
    transform: translateY(1px);
}

.response {
    margin-top: 20px;
    padding: 15px;
    background: #1a1535;
    border-radius: 5px;
    min-height: 50px;
    border: 1px solid #2a1f4d;
    color: #e8e6f0;
}

.response.loading {
    color: #b8b5c9;
    font-style: italic;
}

.response.success {
    color: #5fd88f;
}

.response.error {
    color: #ff6b7a;
}

.info ul {
    list-style-position: inside;
    color: #b8b5c9;
}

.info li {
    padding: 8px 0;
    border-bottom: 1px solid #2a1f4d;
}

.info li:last-child {
    border-bottom: none;
}

footer {
    text-align: center;
    color: #7a7590;
    padding-top: 20px;
    border-top: 1px solid #2a1f4d;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1em;
    }
    
    .logo {
        width: 80px;
        margin: 0 auto 10px;
    }
    
    header {
        margin-bottom: 25px;
        padding-bottom: 15px;
    }
    
    .header-content {
        flex-direction: column;
        align-items: center;
    }
    
    .user-profile {
        position: static;
        width: 100%;
        justify-content: center;
    }
    
    .msisdn-form {
        gap: 20px;
    }
    
    .filter-controls {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-group label {
        font-size: 13px;
    }
    
    .form-input {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .error-message {
        font-size: 12px;
    }
    
    main {
        margin-bottom: 25px;
    }
    
    footer {
        padding-top: 15px;
        font-size: 12px;
    }
    
    .chat-messages {
        max-height: 400px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .message-content {
        font-size: 13px;
    }
    
    .chat-header h3 {
        font-size: 16px;
    }
}
