/* OutsideStaff Mailbox - Email Client Style */
.osmb-mailbox {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    height: 700px;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* Loading State */
.osmb-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
    background: #f9fafb;
}

.osmb-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: osmb-spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes osmb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mailbox Header - Like Gmail */
.osmb-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

.osmb-title {
    margin: 0;
    font-size: 22px;
    font-weight: 400;
    color: #202124;
    display: flex;
    align-items: center;
    gap: 12px;
}

.osmb-title::before {
    content: "📧";
    font-size: 24px;
}

.osmb-count {
    background: #1a73e8;
    color: white;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
}

.osmb-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buttons - Gmail Style */
.osmb-btn {
    background: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #3c4043;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.osmb-btn-refresh.refreshing::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border: 2px solid #dadce0;
    border-top: 2px solid #1a73e8;
    border-radius: 50%;
    animation: osmb-spin 1s linear infinite;
}

.osmb-btn:hover {
    background: #f1f3f4;
    border-color: #dadce0;
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3);
}

.osmb-btn-send {
    background: #1a73e8;
    border-color: #1a73e8;
    color: white;
}

.osmb-btn-send:hover {
    background: #1557b0;
    border-color: #1557b0;
    box-shadow: 0 1px 2px 0 rgba(26, 115, 232, 0.45);
}

.osmb-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.osmb-btn.refreshing {
    position: relative;
    padding-right: 32px; /* Make room for spinner */
}

/* Thread List - Like Email Inbox */
.osmb-thread-list {
    flex: 1;
    overflow-y: auto;
    background: #ffffff;
}

.osmb-thread-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.1s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 72px;
}

.osmb-thread-item:hover {
    background: #f5f5f5;
}

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

.osmb-thread-item.unread {
    background: #f8f9ff;
    font-weight: 600;
}

.osmb-thread-item.unread::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #1a73e8;
}

/* Thread Avatar */
.osmb-thread-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

/* Thread Content */
.osmb-thread-content {
    flex: 1;
    min-width: 0;
}

.osmb-thread-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.osmb-thread-from {
    font-weight: 600;
    color: #202124;
    font-size: 14px;
    margin: 0;
}

.osmb-thread-time {
    font-size: 12px;
    color: #5f6368;
    white-space: nowrap;
    margin-left: 16px;
}

.osmb-thread-subject {
    font-weight: 600;
    color: #202124;
    font-size: 14px;
    margin: 0 0 2px 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.osmb-thread-preview {
    color: #5f6368;
    font-size: 14px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.osmb-thread-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.osmb-thread-badge {
    background: #e8f0fe;
    color: #1a73e8;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.osmb-thread-badge.staff {
    background: #e6f4ea;
    color: #137333;
}

/* Thread View - Like Email Conversation */
.osmb-thread-view {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

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

.osmb-back-btn {
    background: none;
    border: none;
    color: #5f6368;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.osmb-back-btn:hover {
    background: #f1f3f4;
}

.osmb-conversation-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #202124;
}

.osmb-conversation-info p {
    margin: 0;
    font-size: 14px;
    color: #5f6368;
}

.osmb-conversation-header .osmb-conversation-info {
    flex: 1;
    margin-left: 16px;
}

.osmb-thread-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Messages - Like Email Thread */
.osmb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
}

.osmb-message {
    margin-bottom: 20px;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
    animation: osmb-fadeIn 0.3s ease-in;
}

.osmb-message-header {
    background: #f8f9fa;
    padding: 12px 16px;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.osmb-message-from {
    display: flex;
    align-items: center;
    gap: 12px;
}

.osmb-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: white;
    flex-shrink: 0;
}

.osmb-message-sender {
    font-weight: 600;
    color: #202124;
    font-size: 14px;
}

.osmb-message-time {
    font-size: 12px;
    color: #5f6368;
}

.osmb-message-content {
    padding: 16px;
}

.osmb-message-text {
    margin: 0;
    line-height: 1.6;
    color: #202124;
    font-size: 14px;
    word-wrap: break-word;
}

/* Reply Form - Like Gmail Compose */
.osmb-reply-form {
    border-top: 1px solid #e5e7eb;
    padding: 16px 20px;
    background: #ffffff;
}

.osmb-compose-header {
    margin-bottom: 16px;
}

.osmb-compose-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #202124;
}

/* WYSIWYG Editor */
.osmb-editor-container {
    border: 1px solid #dadce0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    background: white;
    position: relative;
}

.osmb-editor-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #e8eaed;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.osmb-editor-btn {
    background: none;
    border: none;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #3c4043;
    transition: background-color 0.2s;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.osmb-editor-btn:hover {
    background: #e8eaed;
}

.osmb-editor-btn:active {
    background: #dadce0;
}

.osmb-editor-divider {
    width: 1px;
    height: 20px;
    background: #dadce0;
    margin: 0 4px;
}

.osmb-message-input {
    min-height: 120px;
    max-height: 300px;
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
    outline: none;
    position: relative;
}

.osmb-message-input.empty::before {
    content: attr(data-placeholder);
    color: #9aa0a6;
    pointer-events: none;
    position: absolute;
}

/* Resize Handle */
.osmb-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nw-resize;
    background: linear-gradient(-45deg, transparent 0%, transparent 30%, #dadce0 30%, #dadce0 35%, transparent 35%, transparent 65%, #dadce0 65%, #dadce0 70%, transparent 70%);
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.osmb-resize-handle:hover {
    opacity: 1;
}

.osmb-reply-actions {
    display: flex;
    justify-content: flex-end;
}

/* Clean Send Button */
.osmb-btn-send-reply {
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
    position: relative;
    overflow: hidden;
}

.osmb-btn-send-reply:hover {
    background: linear-gradient(135deg, #1557b0, #3367d6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
}

.osmb-btn-send-reply:active {
    transform: translateY(0);
}

.osmb-btn-send-reply:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.osmb-btn-send-reply.sending {
    background: linear-gradient(135deg, #34a853, #4caf50);
}

.osmb-send-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.osmb-btn-send-reply:hover .osmb-send-icon {
    transform: translateX(2px);
}

.osmb-send-text {
    transition: all 0.3s ease;
}

/* Empty State */
.osmb-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #5f6368;
    padding: 40px 20px;
    background: #f9fafb;
}

.osmb-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.osmb-empty h4 {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 400;
    color: #202124;
}

.osmb-empty p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    max-width: 400px;
}

/* Error State */
.osmb-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #d93025;
    padding: 40px 20px;
    background: #fef7f0;
}

.osmb-error-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.7;
}

.osmb-error h4 {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 400;
    color: #d93025;
}

.osmb-error p {
    margin: 0 0 20px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #5f6368;
}

/* Login Required State */
.osmb-login-required {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.osmb-login-message {
    text-align: center;
    padding: 40px 20px;
    max-width: 400px;
}

.osmb-login-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.osmb-login-message h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 400;
    color: #202124;
}

.osmb-login-btn {
    display: inline-block;
    background: #1a73e8;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.osmb-login-btn:hover {
    background: #1557b0;
    box-shadow: 0 1px 2px 0 rgba(26, 115, 232, 0.45);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .osmb-mailbox {
        border-radius: 0;
        height: 100vh;
        max-width: none;
    }
    
    .osmb-header {
        padding: 12px 16px;
    }
    
    .osmb-title {
        font-size: 18px;
    }
    
    .osmb-thread-item {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .osmb-thread-avatar {
        align-self: flex-start;
    }
    
    .osmb-thread-content {
        width: 100%;
    }
    
    .osmb-messages {
        padding: 16px;
    }
    
    .osmb-reply-form {
        padding: 16px;
    }
    
    .osmb-conversation-header {
        padding: 12px 16px;
    }
}

/* Scrollbar Styling */
.osmb-thread-list::-webkit-scrollbar,
.osmb-messages::-webkit-scrollbar {
    width: 6px;
}

.osmb-thread-list::-webkit-scrollbar-track,
.osmb-messages::-webkit-scrollbar-track {
    background: #f1f3f4;
}

.osmb-thread-list::-webkit-scrollbar-thumb,
.osmb-messages::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 3px;
}

.osmb-thread-list::-webkit-scrollbar-thumb:hover,
.osmb-messages::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

/* Animations */
@keyframes osmb-fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Focus States */
.osmb-thread-item:focus {
    outline: 2px solid #1a73e8;
    outline-offset: -2px;
}

.osmb-btn:focus {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: #1a73e8;
    color: white;
}