/* ============================================================
   MESSAGES PAGE — 2010 iPhone SMS skeuomorphic UI
   Blue nav-bar + silver/gray throughout
   ============================================================ */

/* Sidebar */
.sidebar {
    background: url('../Sidebar.png') center center / 100% 100% no-repeat !important;
    padding: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    outline: none !important;
}

.main-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 30px 40px;
}

.messages-page .main-content {
    padding: 24px;
}

/* ── Outer shell: leather frame ── */
.messages-container {
    display: flex;
    height: calc(100vh - 140px);
    width: 100%;
    max-width: 1200px;
    background: repeating-linear-gradient(45deg, rgba(0,0,0,0.04) 0px, transparent 2px, transparent 4px, rgba(0,0,0,0.04) 6px),
                repeating-linear-gradient(-45deg, rgba(0,0,0,0.03) 0px, transparent 2px, transparent 4px, rgba(0,0,0,0.03) 6px),
                linear-gradient(135deg, #c4a574 0%, #d4b896 35%, #e6d4b8 50%, #d4b896 65%, #c4a574 100%);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.25), inset 0 2px 0 rgba(255,255,255,0.25), inset 0 -2px 0 rgba(0,0,0,0.15);
    border: 3px solid #8b7355;
    overflow: hidden;
    position: relative;
}

.messages-container::before {
    content: '';
    position: absolute;
    top: 2px; left: 2px; right: 2px;
    height: 3px;
    background: linear-gradient(90deg, rgba(255,255,255,0.4), rgba(255,255,255,0.2), rgba(255,255,255,0.4));
    border-radius: 17px 17px 0 0;
    pointer-events: none;
    z-index: 1;
}

/* ══════════════════════════════════════════
   CONVERSATIONS LIST — iOS sidebar panel
   Light gray with blue section header
   ══════════════════════════════════════════ */
.conversations-list {
    width: 300px;
    flex-shrink: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    /* iOS light gray sidebar */
    background: linear-gradient(to bottom, #e2e5ea 0%, #d8dce3 100%);
    border-right: 1px solid #9aa4b4;
    box-shadow: inset -1px 0 0 rgba(255,255,255,0.3);
}

/* Blue title bar at the top of sidebar — matches chat-header */
.conversations-list h2 {
    margin: 0;
    padding: 14px 16px;
    font-size: 1.15rem;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: bold;
    color: white;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.4);
    letter-spacing: 0.01em;
    /* Same blue gradient as chat-header */
    background: linear-gradient(to bottom,
        #5c9fd6 0%,
        #3a7fc0 45%,
        #2868a8 51%,
        #4080be 100%);
    border-bottom: 1px solid #1f5090;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.3);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* Glossy shine on sidebar title bar */
.conversations-list h2::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.28), rgba(255,255,255,0));
    pointer-events: none;
}

.conversations-list h3 {
    margin: 10px 14px 6px;
    font-size: 0.78rem;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: bold;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.35);
    /* Smaller blue bar for sub-section headers */
    background: linear-gradient(to bottom, #4a8fc6 0%, #2a6faa 100%);
    padding: 5px 10px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden;
}

.conversations-list h3::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.25), rgba(255,255,255,0));
    border-radius: 6px 6px 0 0;
    pointer-events: none;
}

/* Inner scroll area (everything below the h2 title bar) */
.message-controls,
.search-section,
.conversations-section {
    padding-left: 14px;
    padding-right: 14px;
}

/* Message controls */
.message-controls {
    padding-top: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

/* ── Skeuo button (iOS gray pill) ── */
.skeuo-button {
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid #8a9ab0;
    background: linear-gradient(to bottom,
        #d8dce4 0%,
        #c0c5cf 45%,
        #b0b8c4 51%,
        #cdd2da 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.55);
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 600;
    color: #2a3a50;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.15s ease-out;
    font-size: 0.85rem;
    position: relative;
    overflow: hidden;
}

.skeuo-button::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.4), rgba(255,255,255,0));
    border-radius: 10px 10px 0 0;
    pointer-events: none;
}

.skeuo-button:hover {
    background: linear-gradient(to bottom, #e4e8f0 0%, #ccd0d8 45%, #bcc4cc 51%, #d8dde6 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 7px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.6);
}

.skeuo-button:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    background: linear-gradient(to bottom, #b8bec8, #c8cdd6);
}

.skeuo-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Search section ── */
.search-section {
    padding-top: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.search-input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
}

/* iOS blue Search button */
.search-input-container button {
    padding: 8px 14px;
    background: linear-gradient(to bottom,
        #7dc9f8 0%,
        #45a8f0 45%,
        #2e8fd8 51%,
        #4aabf5 100%);
    color: white;
    border: 1px solid #1a6aaa;
    border-radius: 10px;
    cursor: pointer;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 0.85rem;
    font-weight: bold;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.35);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4);
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
}

.search-input-container button::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.35), rgba(255,255,255,0));
    border-radius: 10px 10px 0 0;
    pointer-events: none;
}

.search-input-container button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.5);
}

.search-input-container button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.15), inset 0 1px 3px rgba(0,0,0,0.15);
}

/* iOS rounded search field */
#user-search {
    flex: 1;
    padding: 7px 12px;
    border: 1px solid #8a9ab0;
    border-radius: 12px;
    font-size: 0.88rem;
    font-family: Helvetica, Arial, sans-serif;
    background: rgba(255,255,255,0.9);
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.15), 0 1px 0 rgba(255,255,255,0.5);
    color: #1a1a1a;
}

#user-search:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74,144,217,0.2), inset 0 1px 3px rgba(0,0,0,0.1);
}

.search-results {
    max-height: 200px;
    overflow-y: auto;
}

/* ── User & conversation items ── */
.user-item {
    display: flex;
    align-items: center;
    padding: 7px 8px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 3px;
    transition: background 0.12s;
    border: 1px solid transparent;
}

.user-item:hover {
    background: rgba(74,144,217,0.15);
    border-color: rgba(74,144,217,0.3);
}

.user-item img {
    width: 32px; height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
    border: 1px solid rgba(0,0,0,0.15);
}

.user-item .username {
    font-weight: bold;
    font-size: 0.88rem;
    color: #1a2a3a;
    font-family: Helvetica, Arial, sans-serif;
}

.conversations-section {
    flex: 1;
    padding-top: 6px;
    padding-bottom: 10px;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 9px 8px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 3px;
    transition: all 0.12s;
    border: 1px solid transparent;
    position: relative;
}

.conversation-item:hover {
    background: rgba(74,144,217,0.12);
    border-color: rgba(74,144,217,0.25);
}

.conversation-item.active {
    background: linear-gradient(to bottom, #4a90d9 0%, #2a68b0 100%);
    border-color: #1a5090;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.2);
}

.conversation-item.active .username,
.conversation-item.active .last-message {
    color: white !important;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.3);
}

.conversation-item img {
    width: 44px; height: 44px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.7);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    flex-shrink: 0;
}

.conversation-info p { margin: 0; }

.conversation-info .username {
    font-weight: bold;
    font-size: 0.9rem;
    color: #1a2a3a;
    font-family: Helvetica, Arial, sans-serif;
}

.conversation-info .last-message {
    font-size: 0.82rem;
    color: #4a5a6a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
    font-family: Helvetica, Arial, sans-serif;
}

/* Presence dot */
.presence-dot {
    position: absolute;
    right: 8px; top: 8px;
    width: 12px; height: 12px;
    border-radius: 50%;
    border: 2px solid #d8dce3;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

.presence-online  { background: #2ecc71; }
.presence-offline { background: #9aa4b4; }

/* ══════════════════════════════════════════
   CHAT WINDOW
   ══════════════════════════════════════════ */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #e8e8ed;
    border-radius: 0 17px 17px 0;
    overflow: hidden;
}

/* ── Chat header: iOS navigation bar blue ── */
.chat-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(to bottom,
        #5c9fd6 0%,
        #3a7fc0 45%,
        #2868a8 51%,
        #4080be 100%);
    border-bottom: 1px solid #1f5090;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.35);
    color: white;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.4);
    border-radius: 0 17px 0 0;
    position: relative;
    overflow: hidden;
}

/* Glossy shine on header */
.chat-header::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.28), rgba(255,255,255,0));
    pointer-events: none;
}

.chat-header img {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.7);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.chat-header p,
.chat-header span,
.chat-header strong,
.chat-header h3,
.chat-header div {
    color: white !important;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.4);
    font-family: Helvetica, Arial, sans-serif;
}

/* ── Chat messages area ── */
.chat-messages {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #dce0e8;
}

/* ── Message bubbles: glossy 2010 iPhone style ── */
.message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 68%;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
    min-width: 0;
    position: relative;
    line-height: 1.45;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 0.93rem;
}

/* Sent: glossy iOS green */
.message.sent {
    background: linear-gradient(to bottom,
        #9fe070 0%,
        #5cbf2a 45%,
        #44aa18 51%,
        #65cc35 100%);
    border: 1px solid #2d8010;
    color: white;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.3);
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Glossy shine — sent */
.message.sent::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.38), rgba(255,255,255,0));
    border-radius: 18px 18px 0 0;
    pointer-events: none;
}

/* Tail — sent */
.message.sent::before {
    content: '';
    position: absolute;
    bottom: 0; right: -6px;
    width: 0; height: 0;
    border-top: 10px solid #44aa18;
    border-left: 10px solid transparent;
}

/* Received: glossy silver/white */
.message.received {
    background: linear-gradient(to bottom,
        #ffffff 0%,
        #ebebeb 45%,
        #d8d8d8 51%,
        #e8e8e8 100%);
    border: 1px solid #a0a0a0;
    color: #111;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.9);
}

/* Glossy shine — received */
.message.received::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.72), rgba(255,255,255,0));
    border-radius: 18px 18px 0 0;
    pointer-events: none;
}

/* Tail — received */
.message.received::before {
    content: '';
    position: absolute;
    bottom: 0; left: -6px;
    width: 0; height: 0;
    border-top: 10px solid #d8d8d8;
    border-right: 10px solid transparent;
}

/* Message inner content (sits above ::after gloss) */
.message-content {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.message-text {
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
    white-space: pre-wrap;
    line-height: 1.5;
    max-width: 100%;
    position: relative;
    z-index: 1;
}

.message-sender-name {
    font-size: 0.75rem;
    color: #6a7a8a;
    margin-bottom: 3px;
    padding-left: 4px;
    font-family: Helvetica, Arial, sans-serif;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.65;
    margin-top: 3px;
    text-align: right;
    position: relative;
    z-index: 1;
}

.message.received .message-time {
    text-align: left;
    color: #555;
}

/* ══════════════════════════════════════════
   CHAT INPUT BAR — iOS keyboard chrome
   ══════════════════════════════════════════ */
.chat-input {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    border-top: 1px solid #8090a8;
    background: linear-gradient(to bottom,
        #c8cbd4 0%,
        #b8bcc8 45%,
        #adb2c0 51%,
        #bec2cc 100%);
    border-radius: 0 0 17px 0;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.5);
    position: relative;
    overflow: hidden;
}

/* Glossy shine on input bar */
.chat-input::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.3), rgba(255,255,255,0));
    pointer-events: none;
}

/* Reset all buttons inside chat-input; specific selectors override */
.chat-input button {
    background: none;
    border: none;
    padding: 0;
    animation: none;
    box-shadow: none;
    color: inherit;
}

/* iOS-style rounded message input field */
#message-input {
    width: 100%;
    min-height: 36px;
    max-height: 120px;
    padding: 8px 14px;
    border: 1px solid #8a9ab0;
    border-radius: 18px;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 0.95rem;
    resize: none;
    transition: border-color 0.2s ease;
    background: white;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.18), 0 1px 0 rgba(255,255,255,0.6);
    color: #1a1a1a;
    line-height: 1.4;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

#message-input:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74,144,217,0.2), inset 0 1px 4px rgba(0,0,0,0.12);
}

#message-input::placeholder {
    color: #9aaabb;
    font-style: italic;
}

/* iOS green Send button */
#send-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(to bottom,
        #9fe070 0%,
        #5cbf2a 45%,
        #44aa18 51%,
        #65cc35 100%);
    border: 1px solid #2d8010;
    border-radius: 12px;
    padding: 8px 18px;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.3);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.25);
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
    animation: none;
    z-index: 1;
}

#send-btn::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.38), rgba(255,255,255,0));
    border-radius: 12px 12px 0 0;
    pointer-events: none;
}

#send-btn::before { display: none; }

#send-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}

#send-btn:active {
    transform: translateY(1px);
    filter: brightness(0.93);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2), inset 0 1px 3px rgba(0,0,0,0.2);
}

#send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    filter: none;
    background: linear-gradient(to bottom, #c8cbd4, #adb2c0);
    border-color: #8090a8;
}

.send-icon { font-size: 1rem; }
.send-text  { font-size: 0.9rem; }

/* Input controls row */
.input-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 12px;
    padding: 0 2px;
    position: relative;
    z-index: 1;
}

/* Char count — matches gray input-bar palette */
.char-count {
    font-size: 0.78rem;
    color: #4a5a6a;
    font-family: Helvetica, Arial, monospace;
    background: rgba(255,255,255,0.65);
    padding: 3px 7px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.15);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}

.char-count.warning {
    color: #d97706;
    background: rgba(255,200,50,0.2);
    border-color: #d97706;
}

.char-count.danger {
    color: #dc2626;
    background: rgba(255,0,0,0.1);
    border-color: #dc2626;
}

/* Sticker button — gray glossy pill */
#sticker-select-btn {
    padding: 7px 12px !important;
    background: linear-gradient(to bottom,
        #d8dce4 0%,
        #c0c5cf 45%,
        #b0b8c4 51%,
        #cdd2da 100%) !important;
    border: 1px solid #8a9ab0 !important;
    border-radius: 10px !important;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    color: #2a3a50 !important;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.55) !important;
    position: relative;
    overflow: hidden;
    animation: none !important;
}

#sticker-select-btn::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.4), rgba(255,255,255,0));
    border-radius: 10px 10px 0 0;
    pointer-events: none;
}

/* Selected sticker preview */
#selected-sticker-preview {
    background: rgba(255,255,255,0.7) !important;
    border: 1px solid rgba(0,0,0,0.15) !important;
    border-radius: 10px !important;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}

/* Remove sticker button */
#remove-sticker-btn {
    padding: 5px 10px !important;
    background: linear-gradient(to bottom, #f87171, #dc2626) !important;
    color: white !important;
    border: 1px solid #991b1b !important;
    border-radius: 8px !important;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.2) !important;
    animation: none !important;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .conversations-list { width: 240px; }

    .input-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .char-count {
        text-align: center;
        order: 2;
    }

    #send-btn {
        order: 1;
        justify-content: center;
    }

    #message-input { font-size: 0.9rem; }
}

#message-input:focus {
    outline: 2px solid #4a90d9;
    outline-offset: 2px;
}


/* ═══════════════════════════════
   PREMADE CHAT STYLES
   ═══════════════════════════════ */
.premade-chat-section {
    margin: 8px 14px;
    padding: 8px;
    background: linear-gradient(to bottom, #d0d4dc, #c4c8d0);
    border: 1px solid #8090a8;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.4);
}

.premade-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.premade-chat-header h3 {
    /* Override the global h3 blue-bar style for this specific header */
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    font-size: 0.85rem;
    color: #1a2a3a;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
    text-transform: none;
    letter-spacing: normal;
    font-style: normal;
}

.premade-chat-header h3::after { display: none; }

.safe-badge {
    background: linear-gradient(to bottom, #4ade80, #22c55e);
    color: white;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.6rem;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    text-shadow: 0 -1px 0 rgba(0,0,0,0.2);
}

.premade-description {
    color: #3a4a5a;
    font-size: 0.7rem;
    margin-bottom: 6px;
    line-height: 1.2;
    font-family: Helvetica, Arial, sans-serif;
}

.premade-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0,0,0,0.12);
}

.premade-category-tab {
    padding: 4px 8px;
    background: linear-gradient(to bottom, #e0e4ec, #cdd2da);
    border: 1px solid #8a9ab0;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.4);
    font-family: Helvetica, Arial, sans-serif;
    color: #1a2a3a;
}

.premade-category-tab:hover {
    transform: translateY(-1px);
    background: linear-gradient(to bottom, #e8ecf4, #d8dce8);
}

.premade-category-tab.active {
    background: linear-gradient(to bottom, #5c9fd6 0%, #2868a8 100%);
    color: white;
    border-color: #1f5090;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.2);
}

.premade-search-container,
.premade-search-container-modal { margin-bottom: 6px; }

.premade-search-container input,
.premade-search-container-modal input {
    width: 100%;
    padding: 6px 10px;
    background: rgba(255,255,255,0.85);
    border: 1px solid #8a9ab0;
    border-radius: 10px;
    font-size: 0.75rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.12);
    font-family: Helvetica, Arial, sans-serif;
}

.premade-messages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 4px;
    max-height: 120px;
    overflow-y: auto;
    padding: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
}

.premade-message-btn {
    padding: 4px 8px;
    background: linear-gradient(to bottom, #e0e4ec, #cdd2da);
    border: 1px solid #8a9ab0;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.4);
    font-family: Helvetica, Arial, sans-serif;
    color: #1a2a3a;
    text-align: center;
    word-wrap: break-word;
}

.premade-message-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(to bottom, #e8ecf4, #d8dce8);
}

.premade-message-btn:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.15);
}

.premade-full-selector { margin-top: 6px; }

/* Premade Message Modal */
.premade-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.55);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.premade-modal-content {
    background: linear-gradient(to bottom, #e2e5ea, #d0d4dc);
    border: 1px solid #8090a8;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.4);
    width: 90%;
    max-width: 500px;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.premade-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #8090a8;
    background: linear-gradient(to bottom,
        #5c9fd6 0%,
        #3a7fc0 45%,
        #2868a8 51%,
        #4080be 100%);
    position: relative;
    overflow: hidden;
}

.premade-modal-header::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.28), rgba(255,255,255,0));
    pointer-events: none;
}

.premade-modal-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: bold;
    color: white !important;
    text-shadow: 0 -1px 1px rgba(0,0,0,0.4) !important;
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.premade-modal-header h3::after { display: none; }

.close-btn {
    background: linear-gradient(to bottom, #f87171, #dc2626);
    color: white;
    border: 1px solid #991b1b;
    border-radius: 50%;
    width: 22px; height: 22px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: all 0.1s ease;
    position: relative;
    z-index: 1;
}

.close-btn:hover { transform: scale(1.08); }

.premade-modal-body {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}

.premade-messages-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
    padding: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Under-13 Access Blocked Message */
.age-restriction-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 40px;
    background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.3);
    border: 2px solid rgba(255,255,255,0.2);
    max-width: 600px;
    margin: 0 auto;
}

.age-restriction-message .material-icons {
    font-size: 4rem;
    color: #ef4444;
    margin-bottom: 20px;
}

.age-restriction-message h2 {
    color: #1e293b;
    font-size: 2rem;
    margin: 0 0 15px 0;
}

.age-restriction-message p {
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0 0 30px 0;
}

.age-restriction-message p:last-child {
    color: #94a3b8;
    font-size: 0.95rem;
    margin: 0;
}
