/* ==========================================================================
   Gmail AI Studio - Material Design 3 Design System
   ========================================================================== */

:root {
    --gmail-red: #ea4335;
    --gmail-blue: #1a73e8;
    --gmail-blue-hover: #1557b0;
    --gmail-green: #34a853;
    --gmail-yellow: #fbbc04;
    
    --bg-main: #f6f8fc;
    --bg-header: #f6f8fc;
    --bg-surface: #ffffff;
    --bg-hover: #f1f3f4;
    --bg-active: #e8f0fe;
    --bg-sidebar-active: #c2e7ff;
    
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-muted: #80868b;
    
    --border-color: #e0e0e0;
    --border-light: #f1f3f4;
    
    --shadow-sm: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    --shadow-md: 0 4px 8px 0 rgba(60,64,67,0.2), 0 1px 3px 0 rgba(60,64,67,0.15);
    --shadow-lg: 0 8px 24px 0 rgba(60,64,67,0.25);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 28px;
    --radius-pill: 9999px;
    
    --ai-gradient: linear-gradient(135deg, #4285f4 0%, #9b51e0 50%, #e91e63 100%);
    --ai-bg-light: #f3e8ff;
}

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

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-size: 14px;
    height: 100vh;
    overflow: hidden;
}

/* APP LAYOUT CONTAINER */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* HEADER NAVBAR */
.gmail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 16px;
    background-color: var(--bg-header);
    border-bottom: 1px solid transparent;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 250px;
}

.icon-btn {
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background-color 0.2s ease;
}

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

.logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.app-title {
    font-family: 'Google Sans', sans-serif;
    font-size: 22px;
    font-weight: 500;
    color: var(--text-secondary);
}

.ai-badge {
    background: var(--ai-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* SEARCH BAR */
.header-center {
    flex: 1;
    max-width: 720px;
    padding: 0 16px;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: #eaf1fb;
    border-radius: var(--radius-lg);
    padding: 0 16px;
    height: 48px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar:focus-within {
    background-color: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.search-icon {
    color: var(--text-secondary);
    margin-right: 12px;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: var(--text-primary);
}

/* HEADER RIGHT & ACCOUNT SWITCHER */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-shield {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #e6f4ea;
    color: var(--gmail-green);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #ceead6;
}

.account-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.account-switcher:hover {
    box-shadow: var(--shadow-sm);
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    text-transform: uppercase;
}

.account-info {
    display: flex;
    flex-direction: column;
    max-width: 140px;
    overflow: hidden;
}

.acc-name {
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.acc-email {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* ACCOUNT DROPDOWN MENU */
.account-dropdown-menu {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 340px;
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 1000;
    padding: 16px;
}

.hidden {
    display: none !important;
}

.dropdown-header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.accounts-scroll-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.account-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.account-item-row:hover {
    background-color: var(--bg-hover);
}

.account-item-row.active {
    background-color: var(--bg-active);
}

/* MAIN BODY & SIDEBAR */
.main-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 256px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: var(--bg-main);
}

.compose-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 24px 0 16px;
    background-color: #c2e7ff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: 'Google Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #001d35;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
    margin-bottom: 8px;
}

.compose-btn:hover {
    box-shadow: var(--shadow-md);
    background-color: #b3dfeb;
}

.compose-icon {
    font-size: 24px;
}

.ai-sparkle {
    margin-left: auto;
    color: #6200ee;
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 36px;
    padding: 0 16px 0 24px;
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

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

.nav-item.active {
    background-color: #d3e3fd;
    color: #041e49;
    font-weight: 700;
}

.nav-label {
    flex: 1;
}

.unread-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.spam-badge {
    color: var(--gmail-red);
}

.sidebar-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

.sidebar-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    padding: 4px 12px;
}

.quick-profiles-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
}

/* CENTER CONTENT AREA */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-surface);
    border-radius: 16px 16px 0 0;
    margin-right: 8px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.action-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-light);
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* CATEGORY TABS */
.category-tabs {
    display: flex;
    height: 48px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}

.tab-item {
    flex: 1;
    max-width: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

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

.tab-item.active {
    color: var(--gmail-blue);
    border-bottom-color: var(--gmail-blue);
    font-weight: 700;
}

/* EMAIL LIST VIEW */
.email-list-view {
    flex: 1;
    overflow-y: auto;
}

.email-row {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

.email-row:hover {
    box-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60,64,67,0.3);
    background-color: var(--bg-hover);
}

.email-row.unread {
    background-color: #ffffff;
    font-weight: 700;
}

.email-row.read {
    background-color: #f2f6fc;
    color: var(--text-secondary);
}

.email-select {
    margin-right: 12px;
}

.email-star {
    margin-right: 12px;
    color: var(--text-muted);
}

.email-star.starred {
    color: var(--gmail-yellow);
}

.email-sender {
    width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    padding-right: 12px;
}

.email-content-preview {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.email-subject {
    font-weight: inherit;
    color: var(--text-primary);
}

.email-snippet {
    color: var(--text-muted);
    font-weight: 400;
}

.deliverability-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    text-transform: uppercase;
}

.deliverability-tag.inbox {
    background-color: #e6f4ea;
    color: var(--gmail-green);
}

.deliverability-tag.spam {
    background-color: #fce8e6;
    color: var(--gmail-red);
}

.email-date {
    width: 90px;
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* EMAIL DETAIL VIEW */
.email-detail-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 32px;
    overflow-y: auto;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.detail-subject {
    font-family: 'Google Sans', sans-serif;
    font-size: 22px;
    font-weight: 400;
    flex: 1;
}

.audit-card {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
}

.audit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.audit-score-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #1e8e3e;
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-weight: 600;
}

.hdr-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

.hdr-tag.pass {
    background-color: #d1fae5;
    color: #065f46;
}

.detail-sender-box {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.sender-meta {
    flex: 1;
}

.sender-name-row strong {
    font-size: 15px;
}

.sender-email {
    color: var(--text-secondary);
    font-size: 13px;
    margin-left: 6px;
}

.detail-body-content {
    font-size: 15px;
    line-height: 1.6;
    color: #3c4043;
    padding: 16px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    white-space: pre-wrap;
    min-height: 150px;
}

.smart-replies-container {
    margin: 20px 0;
}

.smart-replies-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #6200ee;
    margin-bottom: 10px;
}

.smart-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.reply-chip {
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.reply-chip:hover {
    background-color: #e2e8f0;
    border-color: #94a3b8;
}

.reply-editor-box {
    margin-top: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    background-color: var(--bg-surface);
}

.reply-editor-box textarea {
    width: 100%;
    height: 100px;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    margin-top: 8px;
}

/* RIGHT AI SIDE PANEL */
.ai-side-panel {
    width: 320px;
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Google Sans', sans-serif;
    font-weight: 500;
    font-size: 16px;
    color: var(--text-primary);
}

.panel-sparkle {
    color: #6200ee;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-card {
    background-color: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-card h3 {
    font-family: 'Google Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input, .form-group textarea, .form-group select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--gmail-blue);
    box-shadow: 0 0 0 2px rgba(26,115,232,0.2);
}

/* BUTTON STYLES */
.btn-primary {
    background-color: var(--gmail-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--gmail-blue-hover);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-success {
    background-color: var(--gmail-green);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-success:hover {
    background-color: #2d9247;
}

.full-width {
    width: 100%;
}

/* METER BAR */
.meter-container {
    margin: 8px 0;
}

.meter-bar {
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    transition: width 0.4s ease, background-color 0.4s ease;
}

.meter-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-top: 4px;
}

.trigger-words-box {
    background-color: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px;
    font-size: 12px;
    max-height: 90px;
    overflow-y: auto;
}

.clean-text {
    color: var(--gmail-green);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* COMPOSE FLOATING DIALOG */
.compose-modal {
    position: fixed;
    bottom: 0;
    right: 80px;
    width: 580px;
    height: 520px;
    background-color: var(--bg-surface);
    border-radius: 12px 12px 0 0;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 2000;
}

.compose-header {
    background-color: #f2f6fc;
    padding: 10px 16px;
    border-radius: 12px 12px 0 0;
    font-family: 'Google Sans', sans-serif;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.compose-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.compose-row {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    border-bottom: 1px solid var(--border-light);
    gap: 8px;
}

.row-label {
    color: var(--text-secondary);
    font-size: 13px;
}

.compose-row input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
}

.live-spam-badge {
    background-color: #e6f4ea;
    color: var(--gmail-green);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
}

.compose-editor {
    flex: 1;
    padding: 12px 16px;
}

.compose-editor textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 14px;
}

.compose-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-ai-assist {
    background: var(--ai-bg-light);
    color: #6200ee;
    border: 1px solid #d8b4fe;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-ai-fix {
    background: #e6f4ea;
    color: var(--gmail-green);
    border: 1px solid #a7f3d0;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
