body {
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s;
    background-color: #f5e6d3; /* Beige */
    background-image: linear-gradient(135deg, #f5e6d3 0%, #e6ccb2 100%);
    background-attachment: fixed;
}

html.dark body {
    background-color: #3e2723; /* Dark Brown */
    background-image: linear-gradient(135deg, #5d4037 0%, #3e2723 100%);
}

/* Base styling for different views */
.view {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* SVG Logo Style */
.logo-svg {
    width: 2.5rem;
    height: 2.5rem;
    color: #4f46e5; /* indigo-600 */
    background-color: #eef2ff; /* indigo-100 */
    padding: 0.5rem;
    border-radius: 0.5rem;
}
html.dark .logo-svg {
    color: #a5b4fc; /* indigo-300 */
    background-color: #3730a3; /* indigo-900 */
}

.action-btn-primary {
    width: 100%;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    outline: none;
    transition: all 0.2s ease-in-out;
    background-color: #6d4c41; /* Brown */
    color: #fff8f0; /* Soft beige text */
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn-primary:hover {
    background-color: #5d4037; /* Darker brown */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.action-btn-primary:focus-visible {
    outline: 2px solid #d7ccc8; /* Light beige */
    outline-offset: 2px;
}
.action-btn-secondary {
    width: 100%;
    color: #374151; /* gray-700 */
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    outline: none;
    transition: all 0.2s ease-in-out;
    background-color: #f3f4f6; /* gray-100 */
    border: 1px solid #d1d5db; /* gray-300 */
    display: flex;
    align-items: center;
    justify-content: center;
}
html.dark .action-btn-secondary {
    color: #e5e7eb; /* gray-200 */
    background-color: #374151; /* gray-700 */
    border-color: #4b5563; /* gray-600 */
}
.action-btn-secondary:hover {
    background-color: #e5e7eb; /* gray-200 */
}
html.dark .action-btn-secondary:hover {
    background-color: #4b5563; /* gray-600 */
}
.action-btn-secondary:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 2px;
}

.icon-btn-primary {
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #4f46e5;
    color: white;
}
.icon-btn-primary:hover {
    background-color: #4338ca;
}
.icon-btn-secondary {
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #eef2ff;
    color: #4f46e5;
}
html.dark .icon-btn-secondary {
    background-color: #3730a3;
    color: #e0e7ff;
}
.icon-btn-secondary:hover {
    background-color: #e0e7ff;
}
html.dark .icon-btn-secondary:hover {
    background-color: #312e81;
}

.icon-btn-primary i, .icon-btn-secondary i {
    width: 1.25rem;
    height: 1.25rem;
}

.input-field {
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    border: 1px solid #d1d5db; /* gray-300 */
    background-color: #f9fafb; /* gray-50 */
    border-radius: 0.5rem;
    transition: all 0.2s;
    color: #111827; /* gray-900 */
}
html.dark .input-field {
    background-color: #1f2937; /* gray-800 */
    border-color: #4b5563; /* gray-600 */
    color: #f3f4f6; /* gray-100 */
}
.input-field::placeholder {
    color: #6b7280; /* gray-500 */
}
html.dark .input-field::placeholder {
    color: #9ca3af; /* gray-400 */
}

.input-field:focus {
    border-color: #6366f1; /* indigo-500 */
    box-shadow: 0 0 0 2px #c7d2fe; /* indigo-200 */
    outline: none;
}
html.dark .input-field:focus {
    border-color: #818cf8; /* indigo-400 */
    box-shadow: 0 0 0 2px #3730a3; /* indigo-900 */
}

.label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}
html.dark .label {
    color: #d1d5db;
}

.file-input {
    display: block;
    width: 100%;
    font-size: 0.875rem;
    color: #6b7280;
    border: 1px dashed #d1d5db;
    padding: 0.5rem;
    border-radius: 0.5rem;
}
html.dark .file-input {
    color: #9ca3af;
    border-color: #4b5563;
}
.file-input::file-selector-button {
    margin-right: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border-width: 0px;
    font-size: 0.875rem;
    font-weight: 600;
    background-color: #eef2ff;
    color: #4f46e5;
    cursor: pointer;
    transition: background-color 0.2s;
}
.file-input:hover::file-selector-button {
    background-color: #e0e7ff;
}
html.dark .file-input::file-selector-button {
    background-color: #3730a3;
    color: #c7d2fe;
}
html.dark .file-input:hover::file-selector-button {
    background-color: #312e81;
}

.separator {
    position: relative;
    margin: 2rem 0;
    text-align: center;
}
.separator span {
    background-color: #fff;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    position: relative;
    z-index: 1;
    letter-spacing: 0.05em;
}
html.dark .separator span {
    background-color: #111827;
    color: #9ca3af;
}
.separator::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background-color: #e5e7eb;
}
html.dark .separator::before {
    background-color: #374151;
}

.view-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: #111827;
    margin-bottom: 0.5rem;
}
html.dark .view-title {
    color: #fff;
}

.view-subtitle {
    color: #6b7280;
    text-align: center;
    margin-bottom: 1.5rem;
}
html.dark .view-subtitle {
    color: #9ca3af;
}

.time-option {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #374151;
    font-weight: 600;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}
html.dark .time-option {
    background-color: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}
.time-option:hover {
    border-color: #a5b4fc;
    color: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
}
html.dark .time-option:hover {
    border-color: #818cf8;
    color: #a5b4fc;
}

.cancel-btn {
    width: 100%;
    margin-top: 1.5rem;
    text-align: center;
    color: #6b7280;
    transition: color 0.2s;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
}
html.dark .cancel-btn {
    color: #9ca3af;
}
.cancel-btn:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}
html.dark .cancel-btn:hover {
    background-color: #374151;
    color: #e5e7eb;
}

/* Chat messages styling */
#chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #fff;
}
#chat-messages::-webkit-scrollbar { width: 6px; }
#chat-messages::-webkit-scrollbar-track { background-color: transparent; }
#chat-messages::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 9999px;
}
html.dark #chat-messages::-webkit-scrollbar-thumb {
    background-color: #4b5563;
}
#chat-messages::-webkit-scrollbar-thumb:hover { 
    background-color: #9ca3af;
}
html.dark #chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: #6b7280;
}

.message-bubble {
    padding: 0.625rem 1rem;
    border-radius: 1.125rem;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
}
.message-bubble .nickname {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.message-bubble img {
    border-radius: 0.75rem;
    margin-top: 0.5rem;
    max-width: 100%;
    height: auto;
    border: 2px solid rgba(0,0,0,0.05);
}
.message-bubble a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    margin-top: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s;
}
.message-bubble a:hover {
    background-color: rgba(0,0,0,0.05);
}
html.dark .message-bubble a:hover {
    background-color: rgba(255,255,255,0.1);
}

.message-container {
    display: flex;
    position: relative;
}
.message-container.sent {
    justify-content: flex-end;
}
.message-container.sent .message-bubble {
    background-color: #4f46e5;
    color: white;
    border-bottom-right-radius: 0.375rem;
}
.message-container.sent .nickname { color: #c7d2fe; }

.message-container.received {
    justify-content: flex-start;
}
.message-container.received .message-bubble {
    background-color: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 0.375rem;
}
html.dark .message-container.received .message-bubble {
    background-color: #374151;
    color: #f3f4f6;
}
.message-container.received .nickname { color: #6b7280; }
html.dark .message-container.received .nickname { color: #9ca3af; }


.notification-message {
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    padding: 0.5rem 0;
    font-style: italic;
    opacity: 0.8;
}
html.dark .notification-message {
    color: #9ca3af;
}

.deleted-message p {
    font-style: italic;
    color: #9ca3af;
}
html.dark .deleted-message p {
    color: #6b7280;
}

/* Loader Spinner */
#loader { display: none; }
.loader-spinner {
    border: 4px solid #e5e7eb;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
html.dark .loader-spinner {
    border: 4px solid #374151;
    border-top: 4px solid #818cf8;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* NEW STYLES for features */
emoji-picker {
    --indicator-color: #4f46e5;
    --border-color: #e5e7eb;
}
html.dark emoji-picker {
    --border-color: #374151;
}

.message-actions {
    display: flex;
    position: absolute;
    top: -0.75rem;
    background-color: white;
    border-radius: 9999px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    padding: 2px;
    border: 1px solid #e5e7eb;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none; 
}
html.dark .message-actions {
    background-color: #1f2937; 
    border-color: #334155;
}
.message-bubble:hover .message-actions {
    opacity: 1;
    pointer-events: auto;
}
.message-container.sent .message-actions { right: 0.5rem; }
.message-container.received .message-actions { right: 0.5rem; }


.message-action-btn {
    padding: 0.375rem;
    border-radius: 9999px;
    color: #6b7280;
    transition: all 0.2s;
}
html.dark .message-action-btn { color: #9ca3af; }
.message-action-btn:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}
html.dark .message-action-btn:hover {
    background-color: #374151;
    color: #e5e7eb;
}

.edited-tag {
    font-size: 0.7rem;
    color: #a5b4fc;
    margin-left: 0.5rem;
    opacity: 0.8;
}
.message-container.received .edited-tag { color: #6b7280; }
html.dark .message-container.received .edited-tag { color: #9ca3af; }

.reply-quote {
    background-color: rgba(0,0,0,0.05);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid #a5b4fc;
    font-size: 0.875rem;
}
.message-container.received .reply-quote {
    border-left-color: #9ca3af;
}
html.dark .reply-quote {
    background-color: rgba(255,255,255,0.05);
    border-left-color: #6366f1;
}
.reply-quote p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reply-quote .font-semibold {
    color: #312e81;
}
html.dark .reply-quote .font-semibold {
    color: #a5b4fc;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}
.modal-content {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    animation: fadeIn 0.3s ease-out;
}
html.dark .modal-content {
    background-color: #1f2937;
}

.modal-close-btn {
    color: #6b7280;
    transition: all 0.2s;
}
html.dark .modal-close-btn { color: #9ca3af; }
.modal-close-btn:hover { color: #111827; }
html.dark .modal-close-btn:hover { color: #f3f4f6; }

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background-color: #f9fafb;
}
html.dark .member-item {
    background-color: #374151;
}
.kick-btn {
    color: #ef4444; /* red-500 */
    padding: 0.25rem;
    border-radius: 9999px;
    opacity: 0;
    transition: all 0.2s;
}
.member-item:hover .kick-btn {
    opacity: 1;
}
.kick-btn:hover {
    background-color: #fee2e2;
}
html.dark .kick-btn:hover {
    background-color: #7f1d1d;
}
/* FULL SCREEN BROWN THEME OVERRIDE */

html.dark body {
    background: linear-gradient(135deg, #5d4037, #3e2723);
}

#app-container {
    background: #f5e6d3; /* Beige */
}

html.dark #app-container {
    background: #3e2723; /* Dark brown */
}

/* Chat header */
html.dark .border-b {
    border-color: #5d4037 !important;
}

/* Received message bubble */
html.dark .message-container.received .message-bubble {
    background-color: #4e342e;
    color: #fff8f0;
}

/* Scrollbar brown */
html.dark #chat-messages::-webkit-scrollbar-thumb {
    background-color: #6d4c41;
}
