:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --success-color: #4cc9f0;
    --border-radius: 12px;
    --box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 0;
}

/* Navbar */
.navbar {
    background-color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 12px 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    color: white;
    font-weight: 600;
    font-size: 1.5rem;
}

.navbar-brand img {
    margin-right: 10px;
    width: 32px;
    height: 32px;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin: 0 10px;
    transition: var(--transition);
    position: relative;
}

.navbar-nav .nav-link:hover {
    color: white;
}

.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 3px;
    background-color: white;
    bottom: -10px;
    left: 0;
    border-radius: 3px;
}

.logout-btn {
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 20px;
    padding: 8px 16px;
    transition: var(--transition);
    font-weight: 500;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.main-row {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.section {
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    background-color: white;
    transition: var(--transition);
}

.section:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

h2,
h3 {
    color: var(--dark-color);
    font-weight: 600;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

h2::after,
h3::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 3px;
    background-color: var(--primary-color);
    bottom: 0;
    left: 0;
    border-radius: 3px;
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
}

.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    padding: 12px 15px;
    transition: var(--transition);
    box-shadow: none;
    background-color: #f8f9fa;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.15);
    background-color: white;
}

/* Color Swatch */
.color-picker-container {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.color-picker-preview {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid #ddd;
    /* Add a subtle border */
}

.color-picker-preview:hover {
    transform: scale(1.05);
}

.color-swatch {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 2px solid white;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    margin: 4px;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}

.color-swatch.active {
    border: 3px solid var(--primary-color);
    transform: scale(1.1);
}

/* Theme selector */
.theme-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.theme-option {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    background-color: #f8f9fa;
}

.theme-option:hover {
    border-color: var(--accent-color);
    background-color: #f0f7ff;
}

.theme-option.active {
    border-color: var(--primary-color);
    background-color: #ebf3ff;
    color: var(--primary-color);
}

.sender-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-align: center;
    color: white;
    font-weight: bold;
    margin-right: 12px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    font-size: 16px;
    overflow: hidden;
    /* Ensure image doesn't overflow */
}

.sender-avatar img {
    width: 100%;
    /* Make sure the image fills the container */
    height: 100%;
    object-fit: cover;
    /* Cover the container */
    object-position: center;
    /* Center the image within the container */
}

/* Drag and Drop Styling */
.sender-avatar.drag-over {
    border: 2px dashed var(--accent-color);
    /* Visual feedback for drag over */
    background-color: #f0f7ff;
}

#senderAvatarColor {
    border: none;
    opacity: 0;
    /* Completely transparent */
    position: absolute;
}

/* --- Drop Zone Specific Styles --- */
#dropZone {
    border: 3px dashed #ccc;
    border-radius: 15px;
    padding: 30px;
    /* Larger padding for a more spacious feel */
    text-align: center;
    cursor: pointer;
    transition: border 0.3s ease, background-color 0.3s ease;
    /* Smooth transitions */
    display: flex;
    /* Use flexbox for centering */
    align-items: center;
    /* Vertical centering */
    justify-content: center;
    /* Horizontal centering */
    flex-direction: column;
    /* Stack elements vertically */
    background-color: #f9f9f9;
    /* Very light grey background */
    margin-bottom: 15px;
    /* Spacing below the drop zone */
}

#dropZone.drag-over {
    border-color: var(--accent-color);
    background-color: #f0f7ff;
    /* Lighter shade on drag-over */
}

#dropZone i {
    font-size: 3rem;
    /* Larger icon */
    color: #999;
    /* Grey icon color */
    margin-bottom: 10px;
    /* Space between icon and text */
}

#dropZone p {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
    /* Remove default margins */
}

#dropZone.has-image {
    border: none;
    padding: 0;
    background: none;
}

#dropZone.has-image img {
    max-width: 100%;
    max-height: 200px;
    /* Limit image height within drop zone */
    border-radius: 12px;
    /* Match border-radius with other elements */
    display: block;
    /*Remove any extra space*/
}


#senderAvatarImage {
    display: none;
    /*Hide browse button*/
}


.btn {
    border-radius: 10px;
    padding: 12px 24px;
    font-weight: 500;
    transition: var(--transition);
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    box-shadow: 0 4px 8px rgba(67, 97, 238, 0.3);
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-success:hover {
    background-color: #3ab7dc;
    border-color: #3ab7dc;
    box-shadow: 0 4px 8px rgba(67, 201, 240, 0.3);
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #5a6268;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.btn-info {
    background-color: #3a0ca3;
    border-color: #3a0ca3;
    color: white;
}

.btn-info:hover {
    background-color: #4a0cB3;
    border-color: #4a0cB3;
    color: white;
    box-shadow: 0 4px 8px rgba(58, 12, 163, 0.3);
}

.btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    color: white;
}

/* Fixed emoji picker position for messages */
.emoji-input-wrapper,
.message-emoji-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.textarea-wrapper {
    display: flex;
    align-items: start;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 5px;
    background-color: #f8f9fa;
    transition: var(--transition);
}

.textarea-wrapper:focus-within {
    border-color: var(--accent-color);
    background-color: white;
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.15);
}

.textarea-wrapper textarea {
    flex-grow: 1;
    border: none;
    resize: vertical;
    padding: 10px;
    background-color: transparent;
    border-radius: 10px;
}

.textarea-wrapper textarea:focus {
    outline: none;
    box-shadow: none;
}

.emoji-button {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: var(--transition);
    align-self: flex-start;
}

.emoji-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Fixed Emoji Picker position */
.emoji-picker {
    position: absolute;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 12px;
    display: none;
    grid-template-columns: repeat(8, 30px);
    /* Default, will be overridden */
    gap: 10px;
    width: fit-content;

}

.emoji-picker.active {
    display: grid;
}


#messageEmojiPicker {
    right: 0;
    top: 100%;
    margin-top: 5px;
}

.emoji-picker .emoji-tab-content {
    overflow-y: auto;
    max-height: 250px;

}

.emoji-picker .emoji-tabs {
    display: flex;
    margin-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.emoji-picker .emoji-tab {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.emoji-picker .emoji-tab:hover {
    background-color: #f0f0f0;
}

.emoji-picker .emoji-tab.active {
    border-bottom-color: var(--primary-color);
}


.emoji-picker span {
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

.emoji-picker span:hover {
    background-color: #f0f0f0;
    transform: scale(1.1);
}

.list-group-item {
    border-radius: 10px !important;
    margin-bottom: 8px;
    transition: var(--transition);
    border: 1px solid #e0e0e0;
    padding: 12px 15px;
}

.list-group-item:hover {
    background-color: #f8f9fa;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
}

.message-array-container {
    border: 1px solid #e0e0e0;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
    white-space: pre-wrap;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: #495057;
    overflow-x: auto;
    max-height: 400px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
}

.message-array-card {
    box-shadow: var(--box-shadow);
    border-radius: 12px;
    border: none;
}

.card-title {
    margin-bottom: 0;
}

.btn-group-sm .btn {
    padding: 6px 10px;
    font-size: 0.875rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Tooltip for color swatches */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

/* Emoji Search Input */
.emoji-search-input {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
}

.sender-avatar img {
    display: block;
    /* Ensure the image is displayed as a block element */
}

/* Drag and Drop Styling */
.sender-avatar.drag-over {
    border: 2px dashed var(--accent-color);
    /* Visual feedback for drag over */
    background-color: #f0f7ff;
}

/* Styles for message drag and drop */
#messagesList.dragging li.drag-over {
    background-color: #f0f7ff;
    /* Highlight when dragging over */
    border: 2px dashed var(--accent-color);
}

#messagesList.dragging li[draggable="true"] {
    cursor: move;
    /* Change cursor to indicate draggability */
}

#messagesList li[draggable="true"] {
    cursor: grab;
    /* Change cursor to indicate draggability */
}

#messagesList li[draggable="true"]:active {
    cursor: grabbing;
}