* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #0c1317;
    color: #e9edef;
    height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    background-color: #2a2f32;
    padding: 20px;
    border-bottom: 1px solid #3b4a54;
    text-align: center;
}

.header h1 {
    color: #00a884;
    font-size: 24px;
    font-weight: 600;
}

#zipFile {
    background-color: #3b4a54;
    color: #e9edef;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
}

#loadChat {
    background-color: #00a884;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

#loadChat:hover {
    background-color: #009973;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #0b141a;
}

.chat-header {
    background-color: #2a2f32;
    padding: 16px 20px;
    border-bottom: 1px solid #3b4a54;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

.chat-header .search-controls {
    width: 100%;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #3b4a54;
}

.chat-header.sticky-active {
    background-color: #1e2428;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid #00a884;
}

.chat-name {
    font-size: 16px;
    font-weight: 600;
    color: #e9edef;
}

.chat-status {
    font-size: 13px;
    color: #8696a0;
    margin-top: 2px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="pattern" x="0" y="0" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%23ffffff" opacity="0.02"/></pattern></defs><rect width="100" height="100" fill="url(%23pattern)"/></svg>');
    scroll-behavior: smooth;
}

.message {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.message.own {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
}

.message.own .message-bubble {
    background-color: #005c4b;
    color: #e9edef;
    border-bottom-right-radius: 2px;
}

.message:not(.own) .message-bubble {
    background-color: #202c33;
    color: #e9edef;
    border-bottom-left-radius: 2px;
}

.message-sender {
    font-size: 13px;
    font-weight: 600;
    color: #00a884;
    margin-bottom: 2px;
}

.message.own .message-sender {
    display: none;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
}

.message-time {
    font-size: 11px;
    color: #8696a0;
    text-align: right;
    margin-top: 4px;
}

.message-media {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 4px;
}

.message-media img {
    max-width: 100%;
    min-width: 200px;
    width: auto;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    display: block;
}

.system-message {
    text-align: center;
    margin: 20px 0;
    padding: 8px 16px;
    background-color: rgba(134, 150, 160, 0.15);
    border-radius: 8px;
    font-size: 13px;
    color: #8696a0;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #8696a0;
}

.error {
    text-align: center;
    padding: 40px;
    color: #ff6b6b;
    background-color: rgba(255, 107, 107, 0.1);
    border-radius: 8px;
    margin: 20px;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #0b141a;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #3b4a54;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #4a5660;
}

.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #2a2f32;
    border-top: 1px solid #3b4a54;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.search-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#zipFile {
    background-color: #3b4a54;
    color: #e9edef;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    /* flex: 1; */
    width: 75%;
}

#clearChat {
    background-color: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: background-color 0.2s;
    min-width: 90px;
}

#clearChat:hover {
    background-color: #ff5252;
}

#clearChat:disabled {
    background-color: #3b4a54;
    cursor: not-allowed;
    opacity: 0.5;
}

.scroll-button {
    background-color: #00a884;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    min-width: 40px;
}

.scroll-button:hover {
    background-color: #009973;
    transform: scale(1.05);
}


.search-toggle {
    background-color: #3b4a54;
    color: #e9edef;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.search-toggle:hover {
    background-color: #4a5660;
}

.search-toggle.active {
    background-color: #00a884;
}

#searchInput {
    background-color: #3b4a54;
    color: #e9edef;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    flex: 1;
    max-width: 300px;
}

#searchInput:focus {
    outline: 2px solid #00a884;
}

#searchResults {
    color: #8696a0;
    font-size: 12px;
    min-width: 50px;
    text-align: center;
}

#searchPrev, #searchNext, #closeSearch {
    background-color: #3b4a54;
    color: #e9edef;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#searchPrev:hover, #searchNext:hover, #closeSearch:hover {
    background-color: #4a5660;
}

#searchPrev:disabled, #searchNext:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.search-highlight {
    background-color: #ffeb3b;
    color: #000;
    padding: 2px 4px;
    border-radius: 2px;
}

.search-current {
    background-color: #ff9800;
    color: #fff;
    padding: 2px 4px;
    border-radius: 2px;
}

/* Link styling */
.message-text .link {
    color: #53bdeb;
    text-decoration: none;
    font-weight: 500;
}

.message-text .link:hover {
    text-decoration: underline;
}

.message-text .maps-link {
    color: #00a884;
    background-color: rgba(0, 168, 132, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin: 2px 0;
}

.message-text .maps-link:hover {
    background-color: rgba(0, 168, 132, 0.2);
    text-decoration: none;
}

.message-text .tikkie-link {
    color: #ff6b35;
    background-color: rgba(255, 107, 53, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin: 2px 0;
}

.message-text .tikkie-link:hover {
    background-color: rgba(255, 107, 53, 0.2);
    text-decoration: none;
}

/* Attachment styling */
.attachment-link {
    display: block;
    text-decoration: none;
    color: inherit;
    background-color: rgba(134, 150, 160, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin: 4px 0;
    border: 1px solid rgba(134, 150, 160, 0.2);
    transition: background-color 0.2s;
}

.attachment-link:hover {
    background-color: rgba(134, 150, 160, 0.2);
    text-decoration: none;
}

.attachment-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.attachment-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-size: 14px;
    font-weight: 500;
    color: #e9edef;
    word-break: break-all;
}

.attachment-size {
    font-size: 12px;
    color: #8696a0;
    margin-top: 2px;
}

/* Video and audio styling */
video, audio {
    border-radius: 8px;
    outline: none;
}

video::-webkit-media-controls-panel,
audio::-webkit-media-controls-panel {
    background-color: rgba(42, 47, 50, 0.8);
}

video::-webkit-media-controls-play-button,
audio::-webkit-media-controls-play-button {
    background-color: #00a884;
    border-radius: 50%;
}