/**
 * BuddyPress & Community Styles for Australis Theme
 *
 * @package Australis
 */

/* ===========================================
   Community Page Layout
   =========================================== */
.comunidad-wrapper {
    background: #f9fafb;
    min-height: 100vh;
    padding-bottom: 60px;
}

.comunidad-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.comunidad-header {
    text-align: center;
    margin-bottom: 30px;
}

.comunidad-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px;
}

.comunidad-header p {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
}

/* Tabs Navigation */
.comunidad-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    background: #fff;
    padding: 10px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.comunidad-tabs .tab-link {
    padding: 12px 24px;
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.comunidad-tabs .tab-link:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.comunidad-tabs .tab-link.active {
    background: #7c3aed;
    color: #fff;
}

/* Activity Post Form */
.activity-post-form {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.post-form-header {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.post-form-header img {
    border-radius: 50%;
    flex-shrink: 0;
}

.post-form-header textarea {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    font-size: 15px;
    resize: none;
    min-height: 80px;
    font-family: inherit;
}

.post-form-header textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.post-form-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.activity-avatar img {
    border-radius: 50%;
    width: 48px;
    height: 48px;
}

.activity-body {
    flex: 1;
}

.activity-header {
    font-size: 14px;
    color: #374151;
    margin-bottom: 8px;
}

.activity-header a {
    color: #7c3aed;
    font-weight: 600;
    text-decoration: none;
}

.activity-content-text {
    color: #1f2937;
    line-height: 1.6;
    margin-bottom: 10px;
}

.activity-meta {
    font-size: 13px;
    color: #9ca3af;
}

/* Members Grid */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.member-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s;
}

.member-card:hover {
    transform: translateY(-2px);
}

.member-avatar img {
    border-radius: 50%;
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.member-info {
    margin-top: 15px;
}

.member-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
}

.member-name a {
    color: #1f2937;
    text-decoration: none;
}

.member-name a:hover {
    color: #7c3aed;
}

.member-since {
    font-size: 13px;
    color: #9ca3af;
}

.member-actions {
    margin-top: 15px;
}

/* Groups Grid */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.group-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.group-avatar img {
    border-radius: 12px;
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.group-info {
    margin-top: 15px;
}

.group-name {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
}

.group-name a {
    color: #1f2937;
    text-decoration: none;
}

.group-name a:hover {
    color: #7c3aed;
}

.group-description {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0 0 10px;
}

.group-meta {
    font-size: 13px;
    color: #9ca3af;
}

.group-actions {
    margin-top: 15px;
}

/* Messages List */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-thread {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 15px;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: background 0.2s;
}

.message-thread:hover {
    background: #f9fafb;
}

.message-thread.unread {
    border-left: 3px solid #7c3aed;
}

.thread-avatar img {
    border-radius: 50%;
    width: 48px;
    height: 48px;
}

.thread-content {
    flex: 1;
}

.thread-from {
    font-weight: 600;
    color: #1f2937;
    font-size: 15px;
}

.thread-subject a {
    color: #4b5563;
    text-decoration: none;
    font-size: 14px;
}

.thread-subject a:hover {
    color: #7c3aed;
}

.thread-excerpt {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 4px;
}

.thread-date {
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
}

.messages-actions {
    margin-top: 20px;
    text-align: center;
}

/* No Content State */
.no-content {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.no-content p {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

/* Estilos de botones movidos a style.css para usar variables globales */

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .comunidad-tabs {
        flex-wrap: wrap;
    }

    .comunidad-tabs .tab-link {
        padding: 10px 16px;
        font-size: 14px;
    }

    .members-grid,
    .groups-grid {
        grid-template-columns: 1fr;
    }

    .message-thread {
        flex-wrap: wrap;
    }

    .thread-date {
        width: 100%;
        margin-top: 8px;
    }
}

/* ===========================================
   General BuddyPress Container
   =========================================== */
#buddypress {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: inherit;
}

/* ===========================================
   Activity Stream
   =========================================== */
#buddypress #activity-stream {
    list-style: none;
    padding: 0;
    margin: 0;
}

#buddypress .activity-item {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

#buddypress .activity-header {
    font-size: 15px;
    color: #374151;
    margin-bottom: 10px;
}

#buddypress .activity-header a {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 600;
}

#buddypress .activity-header a:hover {
    text-decoration: underline;
}

#buddypress .activity-content {
    padding: 15px 0;
    color: #4b5563;
    line-height: 1.6;
}

#buddypress .activity-meta {
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

#buddypress .activity-meta a {
    color: #6b7280;
    text-decoration: none;
    font-size: 13px;
    margin-right: 15px;
}

#buddypress .activity-meta a:hover {
    color: #7c3aed;
}

/* Activity Form */
#buddypress #whats-new-form {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

#buddypress #whats-new {
    width: 100%;
    min-height: 80px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 12px;
    font-size: 15px;
    resize: vertical;
    font-family: inherit;
}

#buddypress #whats-new:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

#buddypress #whats-new-submit input[type="submit"] {
    background: #7c3aed;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

#buddypress #whats-new-submit input[type="submit"]:hover {
    background: #6d28d9;
}

/* ===========================================
   Members Directory
   =========================================== */
#buddypress #members-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

#buddypress #members-list li {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    transition: transform 0.2s, box-shadow 0.2s;
}

#buddypress #members-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

#buddypress #members-list .item-avatar img {
    border-radius: 50%;
    width: 80px;
    height: 80px;
    object-fit: cover;
}

#buddypress #members-list .item-title {
    margin: 15px 0 5px;
    font-size: 16px;
}

#buddypress #members-list .item-title a {
    color: #1f2937;
    text-decoration: none;
    font-weight: 600;
}

#buddypress #members-list .item-meta {
    color: #6b7280;
    font-size: 13px;
}

/* ===========================================
   Groups Directory
   =========================================== */
#buddypress #groups-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

#buddypress #groups-list li {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

#buddypress #groups-list .item-title {
    font-size: 18px;
    margin-bottom: 10px;
}

#buddypress #groups-list .item-title a {
    color: #1f2937;
    text-decoration: none;
    font-weight: 600;
}

#buddypress #groups-list .item-title a:hover {
    color: #7c3aed;
}

#buddypress #groups-list .item-meta {
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 10px;
}

#buddypress #groups-list .item-desc {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

/* ===========================================
   Messages
   =========================================== */
#buddypress .messages-screen {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#buddypress #message-threads {
    list-style: none;
    padding: 0;
    margin: 0;
}

#buddypress #message-threads li {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}

#buddypress #message-threads li:hover {
    background: #f9fafb;
}

#buddypress #message-threads li:last-child {
    border-bottom: none;
}

#buddypress .thread-from,
#buddypress .thread-to {
    font-weight: 600;
    color: #1f2937;
}

#buddypress .thread-subject {
    color: #4b5563;
}

#buddypress .thread-subject a {
    color: inherit;
    text-decoration: none;
}

#buddypress .thread-subject a:hover {
    color: #7c3aed;
}

/* ===========================================
   User Profile
   =========================================== */
#buddypress #item-header {
    background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    color: #fff;
}

#buddypress #item-header .avatar {
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
}

#buddypress #item-header #item-header-content {
    margin-left: 20px;
}

#buddypress #item-header h2 {
    color: #fff;
    margin: 0 0 5px;
}

#buddypress #item-header .user-nicename {
    color: rgba(255, 255, 255, 0.8);
}

/* Profile Navigation */
#buddypress #item-nav {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#buddypress #item-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
}

#buddypress #item-nav ul li {
    margin: 0;
}

#buddypress #item-nav ul li a {
    display: block;
    padding: 15px 20px;
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

#buddypress #item-nav ul li.current a,
#buddypress #item-nav ul li a:hover {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

/* ===========================================
   Buttons
   =========================================== */
#buddypress .generic-button a,
#buddypress a.button,
#buddypress input[type="submit"],
#buddypress button[type="submit"] {
    background: #7c3aed;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-block;
}

#buddypress .generic-button a:hover,
#buddypress a.button:hover,
#buddypress input[type="submit"]:hover,
#buddypress button[type="submit"]:hover {
    background: #6d28d9;
    color: #fff;
}

/* Secondary buttons */
#buddypress .generic-button.secondary a {
    background: #f3f4f6;
    color: #374151;
}

#buddypress .generic-button.secondary a:hover {
    background: #e5e7eb;
}

/* ===========================================
   Forms
   =========================================== */
#buddypress input[type="text"],
#buddypress input[type="email"],
#buddypress input[type="password"],
#buddypress textarea,
#buddypress select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#buddypress input[type="text"]:focus,
#buddypress input[type="email"]:focus,
#buddypress input[type="password"]:focus,
#buddypress textarea:focus,
#buddypress select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* ===========================================
   Notifications
   =========================================== */
#buddypress .bp-feedback {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    color: #166534;
}

#buddypress .bp-feedback.error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

#buddypress .bp-feedback.info {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e40af;
}

/* ===========================================
   Subnav / Filters
   =========================================== */
#buddypress .item-list-tabs {
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#buddypress .item-list-tabs ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

#buddypress .item-list-tabs ul li a {
    display: block;
    padding: 8px 16px;
    color: #4b5563;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

#buddypress .item-list-tabs ul li.selected a,
#buddypress .item-list-tabs ul li a:hover {
    background: #7c3aed;
    color: #fff;
}

/* ===========================================
   Empty States
   =========================================== */
#buddypress .bp-feedback.bp-messages.info {
    text-align: center;
    padding: 40px 20px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 768px) {
    #buddypress {
        padding: 20px 15px;
    }

    #buddypress #members-list {
        grid-template-columns: 1fr;
    }

    #buddypress #groups-list {
        grid-template-columns: 1fr;
    }

    #buddypress #item-nav ul {
        flex-direction: column;
    }

    #buddypress #item-nav ul li a {
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    #buddypress #item-nav ul li.current a,
    #buddypress #item-nav ul li a:hover {
        border-bottom: none;
        border-left-color: #7c3aed;
    }
}

/* ===========================================
   Australis Messaging System
   =========================================== */

/* Header Messages Button */
.messages-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #4b5563;
    transition: all 0.2s;
}

.messages-button:hover {
    background: #e5e7eb;
    color: #7c3aed;
}

.messages-button svg {
    width: 20px;
    height: 20px;
}

.messages-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* Messages Container */
.australis-messages-container {
    display: flex;
    height: 600px;
    min-height: 500px;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

/* Messages Sidebar */
.messages-sidebar {
    width: 320px;
    min-width: 320px;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    background: #fafafa;
    flex-shrink: 0;
}

.messages-sidebar h3 {
    margin: 0;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.messages-sidebar h4 {
    margin: 0;
    padding: 12px 20px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.messages-sidebar .btn-block {
    margin: 15px 20px;
    width: calc(100% - 40px);
}

.messages-sidebar .no-items {
    padding: 15px 20px;
    color: #9ca3af;
    font-size: 14px;
    text-align: center;
}

/* Messages Main Area */
.messages-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.sidebar-header h3 {
    margin: 0;
    padding: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    border: none;
}

.new-message-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #7c3aed;
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.new-message-btn:hover {
    background: #6d28d9;
}

/* Conversations Tabs */
.conversations-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.conv-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.conv-tab:hover {
    color: #7c3aed;
}

.conv-tab.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

/* Conversations List */
.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
    color: inherit;
}

.conversation-item img.conv-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.conversation-item:hover {
    background: #f3f4f6;
}

.conversation-item.active {
    background: #ede9fe;
}

.conversation-item.unread {
    background: #faf5ff;
}

.conversation-item.unread .conv-preview {
    font-weight: 600;
    color: #1f2937;
}

.conv-avatar {
    position: relative;
    flex-shrink: 0;
}

.conv-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.conv-avatar .group-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
}

.conv-info {
    flex: 1;
    min-width: 0;
}

.conv-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-date {
    font-size: 12px;
    color: #9ca3af;
    display: block;
}

.conv-preview {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-meta {
    text-align: right;
    flex-shrink: 0;
}

.conv-time {
    font-size: 11px;
    color: #9ca3af;
}

/* Course Chats List */
.course-chats-list {
    border-top: 1px solid #e5e7eb;
    margin-top: 10px;
}

.course-chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: #1f2937;
}

.course-chat-item:hover {
    background: #f3f4f6;
}

.course-chat-item.active {
    background: #ede9fe;
}

.course-chat-item .course-icon {
    font-size: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.course-chat-item span:last-child {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: #7c3aed;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.no-chat-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.no-chat-selected svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-chat-selected p {
    font-size: 16px;
    margin: 0;
}

/* Chat Header */
.chat-header {
    padding: 18px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 14px;
    background: #EFEAF4;
}

.chat-header img,
.chat-header .chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.chat-header .chat-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}

.chat-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    padding: 0;
    border: none;
    background: none;
}

.chat-header-info span {
    font-size: 13px;
    color: #6b7280;
    display: block;
}

.chat-header-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 15px;
}

.chat-header-status {
    font-size: 12px;
    color: #6b7280;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(135deg, #e8e4f1 0%, #e5ddd5 100%);
    background-attachment: fixed;
}

/* Message Bubble - WhatsApp Style */
.message-bubble {
    max-width: 65%;
    display: flex;
    flex-direction: column;
    position: relative;
    margin-bottom: 8px;
}

.message-bubble.sent {
    align-self: flex-end;
}

.message-bubble.received {
    align-self: flex-start;
}

/* Group message with avatar */
.message-bubble.group-message {
    flex-direction: row;
    gap: 8px;
    max-width: 70%;
}

.message-bubble.group-message.sent {
    flex-direction: row-reverse;
}

.message-bubble .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: auto;
    margin-bottom: 4px;
}

.message-bubble .message-wrapper {
    display: flex;
    flex-direction: column;
}

.message-sender-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
    padding-left: 12px;
}

.message-sender-name {
    font-size: 12px;
    font-weight: 600;
    color: #7c3aed;
}

.teacher-badge {
    font-size: 10px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 500;
}

.message-content {
    padding: 10px;
    border-radius: 8px;
    font-family: Urbanist, sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 18px;
    word-wrap: break-word;
    position: relative;
    box-shadow: none;
}

/* Sent messages */
.message-bubble.sent .message-content {
    background: #5B318C;
    color: #FFF;
    border-radius: 8px;
}

.message-bubble.sent .message-time,
.message-bubble.sent .message-status {
    color: rgba(255,255,255,0.6);
}

/* Received messages */
.message-bubble.received .message-content {
    background: #EFEAF4;
    color: #353535;
    border-radius: 8px;
}

/* Message meta (time + status) */
.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 2px 4px 0;
}

.message-time {
    font-size: 11px;
    color: #6b7280;
}

.message-bubble.sent .message-time {
    color: #6b7280;
}

.message-bubble.sent .message-meta {
    color: #6b7280;
}

/* Message status check */
.message-status {
    display: flex;
    align-items: center;
    color: #6b7280;
}

.message-status svg {
    width: 16px;
    height: 11px;
}

/* Message meta below content */
.message-bubble .message-meta {
    position: static;
    margin-top: 2px;
}

.message-bubble.received .message-meta {
    color: #6b7280;
}

/* Chat Input - Modern WhatsApp Style */
.chat-input-area {
    padding: 16px 20px;
    background: #f0f2f5;
    border-top: 1px solid #e5e7eb;
}

.chat-input-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input-wrapper {
    flex: 1;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: flex-end;
    padding: 6px 12px;
    min-height: 44px;
    transition: box-shadow 0.2s;
}

.chat-input-wrapper:focus-within {
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15);
}

.chat-input-form textarea,
.chat-input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 4px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 24px;
    line-height: 1.4;
    outline: none;
}

.chat-input-form textarea::placeholder,
.chat-input-wrapper textarea::placeholder {
    color: #9ca3af;
}

.send-message-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.send-message-btn:hover {
    background: linear-gradient(135deg, #6d28d9, #5b21b6);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.5);
}

.send-message-btn:active {
    transform: scale(0.95);
}

.send-message-btn:disabled {
    background: #d1d5db;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.send-message-btn svg {
    width: 22px;
    height: 22px;
    margin-left: 2px;
}

/* Old chat-form compatibility */
.chat-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 10px 16px;
    background: #f0f2f5;
}

.chat-form textarea {
    flex: 1;
    border: none;
    background: #fff;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 44px;
    line-height: 1.4;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-form textarea:focus {
    outline: none;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15);
}

.chat-form .btn {
    height: 48px;
    border-radius: 24px;
    padding: 0 24px;
}

/* Message Modal - New Message Form */
#newMessageModal,
.message-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#newMessageModal .modal-content,
.message-modal .modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 450px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#newMessageModal .modal-content h3,
.message-modal .modal-content h3 {
    margin: 0;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
}

#newMessageModal .modal-content form,
.message-modal .modal-content form {
    padding: 20px;
}

#newMessageModal .modal-content .form-group,
.message-modal .modal-content .form-group {
    margin-bottom: 16px;
}

#newMessageModal .modal-content label,
.message-modal .modal-content label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

#newMessageModal .modal-content select,
#newMessageModal .modal-content textarea,
.message-modal .modal-content select,
.message-modal .modal-content textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#newMessageModal .modal-content select:focus,
#newMessageModal .modal-content textarea:focus,
.message-modal .modal-content select:focus,
.message-modal .modal-content textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

#newMessageModal .modal-content textarea,
.message-modal .modal-content textarea {
    resize: vertical;
    min-height: 100px;
}

#newMessageModal .modal-actions,
.message-modal .modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 10px;
}

/* Legacy overlay class */
.message-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.message-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.close-modal {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-modal:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Date Separator - WhatsApp Style */
.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0 12px;
}

.date-separator span {
    font-size: 12px;
    color: #54656f;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 14px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* No Messages State */
.no-messages {
    text-align: center;
    padding: 60px 20px;
    color: #8696a0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.no-messages svg {
    width: 72px;
    height: 72px;
    margin-bottom: 16px;
    opacity: 0.4;
    color: #7c3aed;
}

.no-messages p {
    font-size: 15px;
    margin: 0;
    max-width: 280px;
    line-height: 1.5;
}

/* Welcome Message */
.messages-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    color: #54656f;
    background: linear-gradient(135deg, #f0f2f5 0%, #e8e4f1 100%);
}

.messages-welcome .welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.9;
}

.messages-welcome h3 {
    font-size: 24px;
    font-weight: 300;
    color: #1f2937;
    margin: 0 0 8px;
}

.messages-welcome p {
    font-size: 15px;
    color: #8696a0;
    margin: 0;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .australis-messages-container {
        flex-direction: column;
        height: auto !important;
        min-height: auto;
        border: none;
        border-radius: 0;
        box-shadow: none;
        margin: 0 -16px;
        width: calc(100% + 32px);
    }

    .messages-page-header h2 {
        font-size: 18px !important;
        line-height: 22px !important;
    }

    .messages-page-header p {
        font-size: 13px !important;
        line-height: 17px !important;
    }

    .messages-sidebar {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: none;
        max-height: none;
        overflow-y: visible;
        background: #fff;
    }

    .messages-sidebar h3 {
        padding: 16px;
        font-size: 16px;
        border-bottom: none;
    }

    .messages-sidebar .btn-block {
        margin: 0 16px 12px;
        width: calc(100% - 32px);
    }

    .messages-sidebar h4 {
        padding: 10px 16px 6px;
    }

    .conversation-item {
        padding: 10px 16px;
    }

    .course-chat-item {
        padding: 10px 16px;
    }

    /* Welcome screen compact on mobile */
    .messages-welcome {
        padding: 24px 16px;
        min-height: auto;
        background: #f9f8fb;
    }

    .messages-welcome .welcome-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }

    .messages-welcome h3 {
        font-size: 18px;
    }

    .messages-welcome p {
        font-size: 13px;
    }

    .messages-main {
        min-height: auto;
        border-top: 1px solid #e5e7eb;
    }

    .chat-header {
        padding: 14px 16px !important;
    }

    .chat-messages {
        min-height: 250px;
        padding: 16px !important;
        flex: 1;
    }

    .message-bubble {
        max-width: 85%;
    }

    .chat-input-area {
        padding: 10px 16px !important;
    }

    .chat-header-info h3 {
        font-size: 14px;
    }

    #newMessageModal .modal-content,
    .message-modal .modal-content {
        max-width: calc(100% - 32px);
        margin: 16px;
    }

    .send-message-btn {
        width: 44px;
        height: 44px;
    }
}

/* ===========================================
   Admin Messages Page Styles
   =========================================== */
.teacher-messages-wrap {
    max-width: 1200px;
}

.teacher-messages-wrap .messages-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.teacher-messages-wrap .conversations-panel {
    width: 350px;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
}

.teacher-messages-wrap .conversations-header {
    padding: 15px;
    border-bottom: 1px solid #ccd0d4;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.teacher-messages-wrap .conversations-header h3 {
    margin: 0;
    font-size: 14px;
}

.teacher-messages-wrap .chat-panel {
    flex: 1;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

.teacher-messages-wrap .admin-chat-header {
    padding: 15px;
    border-bottom: 1px solid #ccd0d4;
    background: #f6f7f7;
}

.teacher-messages-wrap .admin-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9f9f9;
}

.teacher-messages-wrap .admin-chat-input {
    padding: 15px;
    border-top: 1px solid #ccd0d4;
    background: #fff;
}

.teacher-messages-wrap .admin-chat-input textarea {
    width: 100%;
    min-height: 60px;
    margin-bottom: 10px;
}
