/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

body {
    margin: 0;
    padding: 0;
    display: block;
}

/* Navigation bar */

.navbar {
    position: sticky;           /* stays at top when scrolling */
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #e2e2e2;
    background-color: #ffffff;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
}

.navbar-links {
    display: flex;
    gap: 14px;
}

.navbar-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
}

.navbar-links a:hover {
    color: #1a73e8;
}

/* Optional: page content spacing below the nav */

.page-content {
    padding: 16px 20px;
}

/* Chat message screen */

/* ======================
   MOBILE (Default)
====================== */
.chat-container {
    width: 100%;
    max-width: 800px;
    height: calc(100vh - 60px);  /* adjust 60px to your navbar height */
    margin: 60px auto 0;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;

    border-radius: 12px;         /* rounded corners for whole chat box */
    overflow: hidden;            /* ensures inner content follows the radius */
}

/* Chat header */

.chat-header {
    background: #4a76a8;
    color: #ffffff;
    padding: 16px;
    font-size: 18px;
    font-weight: bold;

    /* Optional: if you only want the top rounded explicitly */
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.chat-messages {
    flex: 1;
    min-height: 0;             /* IMPORTANT for scrolling inside flex */
    padding: 15px;
    overflow-y: auto;          /* Enables vertical scroll */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 75%;
    padding: 10px 12px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.sent {
    align-self: flex-end;
    background-color: #4a76a8;
    color: #ffffff;
    border-bottom-right-radius: 5px;
}

.received {
    align-self: flex-start;
    background-color: #e4e6eb;
    color: #000000;
    border-bottom-left-radius: 5px;
}

.chat-input {
    display: flex;
    border-top: 1px solid #ddd;
    padding: 10px;
    gap: 8px;
    flex-shrink: 0;            /* Prevent input from shrinking */
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 14px;
    outline: none;
}

.chat-input button {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #4a76a8;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
}

/* ======================
   DESKTOP
====================== */
@media (min-width: 768px) {

    body {
        padding: 40px;
    }

    .chat-container {
        width: 90%;
        max-width: 1000px;
        height: 80vh;
        max-height: 800px;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    }

    .chat-header {
        font-size: 20px;
        padding: 20px;
    }

    .chat-messages {
        padding: 25px;
        gap: 15px;
    }

    .message {
        max-width: 60%;
        padding: 14px 16px;
        font-size: 15px;
    }

    .chat-input {
        padding: 15px;
    }

    .chat-input input {
        padding: 14px;
        font-size: 15px;
    }

    .chat-input button {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Messages index / empty state */

.messages-page {
    max-width: 960px;
    margin: 0 auto;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 24px;
}

.messages-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    padding: 20px;
}

.messages-empty {
    text-align: center;
    padding: 32px 16px;
    color: #666;
    font-size: 0.95rem;
}

.messages-empty-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}

.messages-actions {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.button-primary {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    background: #4a76a8;
    color: #ffffff;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
}

.button-primary:hover {
    background: #3b5f87;
}

.button-secondary {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    background: #e4e6eb;
    color: #111;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
}

.button-secondary:hover {
    background: #d4d6dd;
}

/* Small tweak so page content matches chat padding patterns */
.page-content.messages-page-wrapper {
    padding-top: 24px;
}