/* ============================================
   Shad - Inbox Styles
   ============================================ */

.inbox-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: 100%;
    overflow: hidden;
}

/* ---- Email List Panel ---- */

.email-list-panel {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-white);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-white);
    flex-shrink: 0;
}

.account-switcher {
    margin-left: auto;
    margin-right: -4px;
}

.account-select {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-family: inherit;
    background: var(--bg-main);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}

.account-select:focus {
    border-color: var(--accent);
}

.panel-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.count-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.refresh-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

.refresh-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.refresh-btn:active {
    transform: rotate(45deg);
}

.email-list {
    overflow-y: auto;
    flex: 1;
}

/* ---- Email Item ---- */

.email-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.email-item:hover {
    background: var(--hover-bg);
}

.email-item.selected {
    background: #e8f0fe;
}

.email-item.unread {
    border-left: 3px solid var(--accent);
}

.email-item.unread .email-sender {
    font-weight: 600;
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.email-sender {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}

.email-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 8px;
}

.email-subject {
    font-size: 0.8125rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
}

.attachment-icon {
    font-size: 0.75rem;
    margin-left: 6px;
    opacity: 0.5;
    flex-shrink: 0;
}

.email-preview {
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

/* ---- Email Detail Panel ---- */

.email-detail-panel {
    overflow-y: auto;
    background: var(--bg-main);
    padding: 0;
}

.detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 0.9rem;
    user-select: none;
}

.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detail-subject {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
    padding: 24px 28px 0;
    line-height: 1.4;
}

.detail-meta {
    padding: 0 28px 16px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-bottom: 1px solid var(--border);
}

.detail-meta strong {
    color: var(--text-primary);
    font-weight: 600;
}

.detail-meta div {
    padding: 1px 0;
}

.detail-date {
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ---- Detail Actions ---- */

.detail-actions {
    padding: 12px 28px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-white);
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
    border: 1px solid;
    font-weight: 500;
    font-family: inherit;
    line-height: 1;
}

.btn:active {
    transform: scale(0.97);
}

.btn-unflag {
    border-color: var(--danger);
    color: var(--danger);
    background: transparent;
}

.btn-unflag:hover {
    background: var(--danger);
    color: #fff;
}

.btn-reply {
    border-color: var(--accent);
    color: var(--accent);
    background: transparent;
}

.btn-reply:hover {
    background: var(--accent);
    color: #fff;
}

.btn-reply-all {
    border-color: var(--accent);
    color: var(--accent);
    background: transparent;
}

.btn-reply-all:hover {
    background: var(--accent);
    color: #fff;
}

.btn-draft {
    border-color: #7c3aed;
    color: #7c3aed;
}

.btn-draft:hover {
    background: #7c3aed;
    color: #fff;
}

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

.btn-send {
    border-color: var(--accent);
    color: #fff;
    background: var(--accent);
}

.btn-send:hover {
    opacity: 0.9;
}

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

.btn-cancel {
    border-color: var(--border);
    color: var(--text-secondary);
    background: transparent;
}

.btn-cancel:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

/* ---- Reply Form ---- */

.reply-form-container {
    margin: 0 28px 16px;
    padding: 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.reply-form-container h3 {
    margin: 0 0 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.reply-recipients {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.reply-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 120px;
    color: var(--text-primary);
    background: var(--bg-main);
    box-sizing: border-box;
}

.reply-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.sig-preview {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    opacity: 0.7;
}

.sig-preview img {
    display: block;
    margin-bottom: 6px;
}

.sig-links {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'Lato Light', Lato, sans-serif;
}

.reply-btn-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ---- Email Body ---- */

.email-body-frame {
    width: 100%;
    min-height: 300px;
    border: none;
    background: var(--bg-white);
    display: block;
}

/* ---- Attachments ---- */

.attachments-section {
    padding: 20px 28px;
    border-top: 1px solid var(--border);
}

.attachments-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--text-primary);
}

.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    font-size: 0.8125rem;
}

.attachment-card:hover {
    border-color: var(--accent);
    background: #f0f4ff;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.1);
}

.attachment-name {
    font-weight: 500;
}

.attachment-size {
    color: var(--text-secondary);
    font-size: 0.75rem;
}
