html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: center;
}

#protected-content {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    display: flex;
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    max-height: 800px;
    background-color: #fff;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    overflow: hidden;
    flex-direction: row;
}

.sidebar {
    width: 30%;
    min-width: 220px;
    border-right: 1px solid #ddd;
    padding: 15px;
    box-sizing: border-box;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar h2 {
    margin-top: 0;
    font-size: 1.1em;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

#global-search-container {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

#global-search-container input[type="text"] {
    width: calc(100% - 16px);
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.9em;
}

#conversation-list {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
}

.conversation-item {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item:hover {
    background-color: #e9e9e9;
}

.conversation-item.active {
    background-color: #d1e7fd;
    font-weight: bold;
}

.chat-area {
    width: 70%;
    flex-grow: 1;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#search-bar-container {
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    background-color: #f9f9f9;
    flex-shrink: 0;
    display: flex;
    gap: 5px;
}

#search-bar-container input[type="text"] {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
}

#search-bar-container button {
    padding: 8px 10px;
    border: 1px solid #ccc;
    background-color: #eee;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

#search-bar-container button:hover {
    background-color: #ddd;
}

#chat-header {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #ddd;
    font-size: 1.1em;
    color: #333;
    flex-shrink: 0;
    background-color: #f9f9f9;
}

#chat-header span#chat-header-name-span {
    flex-grow: 1;
}

#chat-header-id {
    font-size: 0.8em;
    color: #555;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    margin-left: 10px;
    white-space: nowrap;
}

#chat-header-id:hover {
    background-color: #007bff;
    color: white;
}

#messages-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: #fff;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.message {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 75%;
    line-height: 1.4;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
    clear: both;
}

.message.in {
    background-color: #e9e9eb;
    float: left;
    margin-right: auto;
}

.message.out {
    background-color: #dcf8c6;
    float: right;
    margin-left: auto;
}

.message .sender {
    font-weight: bold;
    font-size: 0.8em;
    margin-bottom: 4px;
    color: #333;
}

.message.out .sender {
    color: #075e54;
}

.message .timestamp {
    font-size: 0.7em;
    color: #777;
    display: block;
    margin-top: 5px;
    text-align: right;
}

.message.in .timestamp {
    text-align: left;
}

#messages-container mark {
    background-color: yellow;
    padding: 0;
    color: black;
}

#capture-details-wrapper {
    border-top: 1px solid #ddd;
    background-color: #f9f9f9;
    flex-shrink: 0;
    display: block;
}

#capture-details-header {
    padding: 12px 15px;
    /* Increased padding */
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    background-color: #efefef;
    /* Lighter header background */
    border-bottom: 1px solid #ddd;
}

#capture-details-header:not(.active) {
    border-bottom-color: #ddd;
}

#capture-details-header.active {
    border-bottom-color: transparent;
}

#capture-details-header h3 {
    margin: 0;
    font-size: 1em;
    font-weight: bold;
}

#capture-details-header .toggle-icon {
    font-size: 1.5em;
    font-weight: bold;
    /* Larger icon */
    transition: transform 0.2s ease-in-out;
    padding: 0 8px;
    color: #007bff;
    line-height: 1;
}

#capture-details-header .toggle-icon:hover {
    color: #0056b3;
}

#capture-details-header.active .toggle-icon {
    transform: rotate(0deg);
}

/* For '-' icon */
#capture-details-header:not(.active) .toggle-icon {
    transform: rotate(0deg);
}

/* For '+' icon (JS changes text) */

#capture-details-content {
    padding: 0 15px 0px 15px;
    display: block;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding-top 0.3s ease-out, padding-bottom 0.3s ease-out;
    background-color: #f9f9f9;
}

#capture-details-content.show {
    max-height: 500px;
    padding-top: 15px;
    padding-bottom: 15px;
}

#capture-details-content label {
    font-weight: bold;
    font-size: 0.9em;
    display: block;
    margin-bottom: 3px;
}

#capture-details-content input[type="text"],
#capture-details-content textarea {
    width: calc(100% - 16px);
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    box-sizing: border-box;
}

#capture-details-content button {
    padding: 10px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

#capture-details-content button:hover {
    background-color: #0056b3;
}

#capture-details-content #save-status-message {
    font-size: 0.8em;
    margin-top: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
    }

    .container {
        flex-direction: column;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }

    .sidebar {
        width: 100%;
        min-width: auto;
        border-right: none;
        border-bottom: 1px solid #ddd;
        max-height: 40vh;
        flex-shrink: 0;
    }

    #global-search-container {
        padding: 8px 10px;
    }

    .chat-area {
        width: 100%;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 0;
        min-height: 0;
    }

    #search-bar-container {
        padding: 8px 10px;
    }

    #chat-header {
        padding: 10px;
        flex-shrink: 0;
    }

    #messages-container {
        flex-grow: 1;
        overflow-y: auto;
        padding: 10px;
        min-height: 0;
    }

    #capture-details-wrapper {
        padding: 0;
        flex-shrink: 0;
        margin: 0;
    }

    #capture-details-header {
        padding: 10px 12px;
    }

    /* Adjusted from 8px 10px */
    #capture-details-content {
        padding: 0 10px 0px 10px;
    }

    #capture-details-content.show {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    /* Adjusted from 8px */
    .message {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    #global-search-container input[type="text"] {
        font-size: 0.85em;
    }

    #search-bar-container {
        flex-direction: column;
    }

    #search-bar-container input[type="text"] {
        width: calc(100% - 16px);
        margin-bottom: 5px;
    }

    #search-bar-container button {
        width: 100%;
        box-sizing: border-box;
    }

    .sidebar h2,
    #chat-header {
        font-size: 1em;
    }

    #chat-header-id {
        font-size: 0.75em;
    }

    .conversation-item {
        font-size: 0.8em;
        padding: 7px 8px;
    }

    .message {
        padding: 6px 10px;
        margin-bottom: 10px;
        font-size: 0.9em;
    }

    #capture-details-header h3 {
        font-size: 0.95em;
    }

    #capture-details-header .toggle-icon {
        font-size: 1.3em;
    }

    /* Adjusted from 1.3em */
    #capture-details-content label,
    #capture-details-content input,
    #capture-details-content textarea,
    #capture-details-content button {
        font-size: 0.85em;
    }
}