/************* Reset and Base Styles *************/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lato', sans-serif;
    background-color: #E8EEFC;
    color: #333;
    line-height: 1.6;
}

/************* Professional Header *************/

.brand.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        color: #0043BE;
    }
    50% {
        color: #6BB6FF;
    }
}

.trust-header {
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 1.5rem 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.firm-identity {
    display: flex;
    align-items: center;
    justify-self: start;
}

.header-logo {
    height: 35px;
    width: auto;
    display: block;
}

.brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0043BE;
    text-align: center;
    justify-self: center;
}

.attorney-info {
    font-size: 0.85rem;
    color: #495057;
    font-weight: bold;
    text-align: right;
    justify-self: end;
    padding-right: 3rem;
}

.divider {
    color: #dee2e6;
    margin: 0 0.5rem;
}

.btn-logout {
    position: absolute;
    right: 2rem;
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: none;
}

.btn-logout:hover {
    background: #c82333;
}

/************* Three-Dot Menu *************/

.menu-container {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.2s;
    display: none;
}

.menu-toggle:hover {
    background-color: #f0f0f0;
}

.menu-toggle .dot {
    width: 4px;
    height: 4px;
    background-color: #666;
    border-radius: 50%;
    display: block;
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
    transition: background-color 0.2s;
    border-radius: 8px;
}

.menu-item:hover {
    background-color: #f8f9fa;
}

.menu-item#logoutBtn {
    color: #dc3545;
}

.menu-item#logoutBtn:hover {
    background-color: #fff5f5;
}

/************* Login Screen *************/

#login {
    max-width: 400px;
    margin: 10vh auto;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#login h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: #333;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input, .form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus, .form-control:focus {
    outline: none;
    border-color: #007bff;
}

.btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
}

.btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: #007bff;
}

.btn-add {
    background: #6ec250;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-add:hover {
    background: #218838;
}

#status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

#status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/************* Portal Layout *************/

#portal {
    display: none;
    min-height: calc(100vh - 80px);
}

.portal-container {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/************* Side Bar *************/

.sidebar {
    width: 350px;
    flex-shrink: 0;
}

.sidebar-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #E0E0E0;
}

/************* Activity Feed *************/

.activity-card {
}

.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background: #f8f9fa;
    margin: 0 -0.5rem;
    padding: 0.75rem 0.5rem;
}

.activity-item.empty {
    cursor: default;
    color: #666;
}

.activity-item.empty:hover {
    background: transparent;
    margin: 0;
    padding: 0.75rem 0;
}

.activity-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.icon-payment {
    background: #dbf0d3;
}

.icon-payment svg {
    color: #6ec250;
}

.icon-contract {
    background: #e3f6fa;
}

.icon-contract svg {
    color: #43c4e0;
}

.icon-documents {
    background: #e1d3ff;
}

.icon-documents svg {
    color: #8850ff;
}

.icon-hub {
    background: #43c4e0;
}

.icon-hub svg {
    color: #ffffff;
}

.icon-default {
    background: #f0f0f0;
}

.icon-default svg {
    color: #666;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.activity-type {
    font-size: 0.9rem;
    color: #000;
}

.activity-date {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
}

.activity-detail {
    font-size: 0.85rem;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/************* Contact Info *************/

.contact-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contact-detail {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    color: #555;
    font-size: 0.95rem;
}

.contact-detail .icon {
    margin-right: 0.75rem;
    width: 1.2rem;
    display: flex;  
    align-items: center;
    justify-content: center;
}

.contact-link {
    color: inherit;
    text-decoration: none;
    transition: text-decoration 0.2s ease;
}

.contact-link:hover {
    text-decoration: underline;
}

.contact-link:visited {
    color: inherit;
}

.contact-link:active {
    color: inherit;
    text-decoration: none;
}

/************* Notes *************/

.note-description {
    color: #666;
    font-size: 0.85rem;
    margin: 0.25rem 0;
    line-height: 1.4;
}

.note-item.complete {
    background-color: #f0fff0;
    border: 1px solid #9fd89f;
}

.note-item.overdue {
    background-color: #fff0f0;
    border: 1px solid #e5a5a5;
}

.note-item.active {
    background-color: #f0f8ff;
    border: 1px solid #8bb8d8;
}

.note-item.empty {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #d0d0d0;
}

.note-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.note-icon {
    width: 40px;
    height: 40px;
    background: #6c757d;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.2rem;
}

.note-title {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.note-date {
    color: #6c757d;
    font-size: 0.85rem;
}

.note-priority { 
    font-size: 12px; 
    color: #666; 
    margin-top: 2px;
}

.priority-dots { 
    letter-spacing: 2px;
    color: #333;
}

/************* Admin Bar *************/

.admin-bar {
    display: none;
    border: 2px solid #0043BE;
    background: #E8EEFC;
}

.admin-bar h3 {
    color: #0043BE;
}

/************* Main Content *************/

.main-content {
    flex: 1;
    min-width: 0;
}

.content-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #E0E0E0;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.content-card h2 {
    font-size: 1.2rem;
    letter-spacing: 0.05rem;
    font-weight: 600;
    color: #333;
}

/************* File List *************/

.file-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.file-details {
    flex: 1;
}

.file-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.5rem;
    color: white;
}

.file-icon-img {
    width: 32px;
    height: 40px;
    margin-right: 1rem;
    flex-shrink: 0;
}

.file-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0.5rem;
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.2s;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item:hover {
    background: #f8f9fa;
}

.file-item a {
    color: #000000;
    text-decoration: none;
}

.file-item a:hover {
    color: #333333;
    text-decoration: underline;
}

.file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.file-meta {
    color: #6c757d;
    font-size: 0.9rem;
}

.file-link {
    color: #007bff;
    text-decoration: none;
    font-size: 0.85rem;
    display: block;
}

.file-link:hover {
    text-decoration: underline;
}

.file-list {
    display: flex;
    flex-direction: column;
}

/************* Messages *************/

.message-thread {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.btn-primary.btn-message:disabled {
    background: #ccc;
}

.btn-primary.btn-message {
    background: #6ec250;
}

.bubble {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem !important;
    animation: slideIn 0.3s ease-out;
    max-width: 70%; 
    width: fit-content; 
}

.bubble.brett {
    align-items: flex-end;
    background: #0043BE;
    color: #E8EEFC;
    border-radius: 10px;
    margin-left: auto;
    padding: 10px 12px;
    width: fit-content;
}

.bubble.brett .meta {
    color: #E8EEFC !important;
}

.bubble.client {
    align-items: flex-start;
    background: #E8EEFC;
    color: #0043BE;
    border-radius: 10px;
    margin-right: auto;
    padding: 10px 12px;
    width: fit-content;
}

.bubble.client .meta {
    color: #0043BE !important;
}

.bubble-content {
    max-width: 70%;
    padding: 1rem;
    border-radius: 16px;
    position: relative;
}

.bubble-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
    margin: 0 0.75rem;
    flex-shrink: 0;
}

.bubble.brett .bubble-avatar {
    background: #007bff;
    order: 2;
}

.bubble.client .bubble-avatar {
    background: #28a745;
    order: 1;
}

.bubble.brett .bubble-content {
    order: 1;
}

.bubble.client .bubble-content {
    order: 2;
}

.meta {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
    color: #000 !important;
}

.message-wrapper {
    margin: 0rem 1rem 1rem 1rem;
}

.message-wrapper .meta {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.message-wrapper.brett .meta {
    text-align: right;
}

.message-wrapper.client .meta {
    text-align: left;
}

.msg-body {
    font-size: 0.95rem;
    line-height: 1.4;
}

/************* Message Input *************/

.message-input-container {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

#msgInput {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 1rem;
    min-height: 80px;
    width: 100%;
}

#msgInput:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

#msgThread {
    box-shadow: inset 0 10px 10px -10px rgba(0, 0, 0, 0.1);
}

#sendBtn {
    width: auto;
    padding: 0.75rem 2rem;
}

/************* Quill Rich Text Editor *************/

#quill-editor-wrapper {
    width: 100%;
}

#quill-editor {
    font-family: 'Lato', sans-serif;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

#quill-editor .ql-container {
    border: none;
    font-size: 1rem;
    min-height: 150px;
    border-radius: 0 0 8px 8px;
}

.ql-container.ql-snow {
    border-radius: 0 0 8px 8px !important;
}

#quill-editor .ql-editor {
    min-height: 150px;
    padding: 1rem;
    font-size: 1rem;
    line-height: 1.6;
}

#quill-editor .ql-editor.ql-blank::before {
    color: #999;
    font-style: normal;
    left: 1rem;
    font-size: 1rem;
}

#quill-editor .ql-toolbar {
    border: none;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    padding: 0.75rem;
}

#quill-editor .ql-formats {
    margin-right: 10px;
}

/* Message input container - stack vertically */
.message-input-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#sendBtn {
    width: 100%;
    padding: 0.75rem 2rem;
}

/* Rich text content styling in messages */
.msg-body p {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.msg-body p:last-child {
    margin-bottom: 0;
}

.msg-body ul, .msg-body ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.msg-body li {
    margin-bottom: 0.25rem;
}

.msg-body a {
    color: inherit;
    text-decoration: underline;
}

.msg-body strong {
    font-weight: 600;
}

/************* Error Notification *************/

.error-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    max-width: 350px;
}

.error-notification.show {
    transform: translateX(0);
}

.error-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.error-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: 1rem;
    opacity: 0.8;
}

.error-close:hover {
    opacity: 1;
}

/************* Professional Footer *************/

.professional-footer {
    background: #333;
    color: white;
    margin-top: 3rem;
    padding: 2rem 0;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.footer-logo {
    height: 40px;
    width: auto;
    margin-bottom: 0;
}

.footer-divider {
    width: 60px;
    height: 2px;
    background: rgba(255,255,255,0.3);
    margin: 1rem auto;
}

.footer-firm {
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.footer-contact {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0;
    opacity: 0.9;
}

.footer-contact a {
    color: white;
    text-decoration: none;
}

.footer-contact a:hover {
    text-decoration: underline;
}

/************* Animations *************/

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .portal-container {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
    
    .header-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        text-align: center;
        gap: 0.75rem;
    }
    
    .firm-identity {
        justify-self: center;
        grid-row: 1;
    }
    
    .brand {
        grid-row: 2;
    }
    
    .attorney-info {
        display: none;
    }
    
    .menu-container {
        position: absolute;
        right: 1rem;
        top: 1.5rem;
        transform: none;
    }
    
    .divider {
        display: none;
    }
    
    .footer-firm {
        line-height: 1.6;
    }
    
    .bubble-content {
        max-width: 85%;
    }
    
    .message-input-container {
        flex-direction: column;
    }
    
    #sendBtn {
        width: 100%;
    }
}
