/* AwesomeMail - Unified Webmail MVP Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f5f5f5;
}

/* Auth Pages */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #667eea;
}

.auth-box h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #666;
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    background: #667eea;
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-header h1 {
    font-size: 20px;
    margin: 0;
}

.app-header nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.app-header nav a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 4px;
    transition: background 0.2s;
}

.app-header nav a:hover {
    background: rgba(255,255,255,0.1);
}

.user-info {
    color: rgba(255,255,255,0.9);
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    padding: 8px 15px !important;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3) !important;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.sidebar-item {
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.sidebar-item:hover {
    background: #f5f5f5;
}

.sidebar-item.active {
    border-left-color: #667eea;
    background: #f0f4ff;
    color: #667eea;
    font-weight: 500;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px;
}

.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #fafafa;
}

/* Inbox 3-pane layout */
.inbox-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fafafa;
    overflow: hidden;
}

.email-panes {
    display: flex;
    flex: 1;
    gap: 0;
    overflow: hidden;
}

.email-list-pane {
    width: 400px;
    border-right: 1px solid #e0e0e0;
    background: white;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.email-preview-pane {
    flex: 1;
    background: white;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.email-preview-empty,
.email-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-empty-state {
    text-align: center;
    color: #999;
    font-size: 16px;
}

.email-preview-header {
    padding: 30px;
    border-bottom: 2px solid #e0e0e0;
    background: #fafafa;
}

.email-preview-header h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 20px;
}

.email-preview-meta {
    color: #666;
    font-size: 14px;
}

.email-preview-meta div {
    margin-bottom: 5px;
}

.email-details-toggle {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.btn-link {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}

.btn-link:hover {
    text-decoration: underline;
}

.email-details {
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    font-size: 13px;
}

.details-section {
    margin-bottom: 15px;
}

.details-section:last-child {
    margin-bottom: 0;
}

.details-section h4 {
    margin-bottom: 10px;
    color: #667eea;
    font-size: 14px;
}

.details-section code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 12px;
    border: 1px solid #e0e0e0;
}

.email-preview-body {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
}

.email-body-iframe {
    width: 100%;
    min-height: 500px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.email-body-text {
    white-space: pre-wrap;
    font-family: inherit;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 4px;
    margin: 0;
}

.loading::after {
    content: 'Loading...';
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.preview-error {
    text-align: center;
    color: #dc3545;
    padding: 40px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Alerts */
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Email List */
.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    gap: 15px;
}

.inbox-header h2 {
    margin: 0;
    flex-shrink: 0;
}

.inbox-stats {
    display: flex;
    gap: 15px;
    color: #666;
    font-size: 14px;
    flex-grow: 1;
}

.inbox-stats span {
    white-space: nowrap;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.pagination-bottom {
    border-bottom: none;
    border-top: 1px solid #e0e0e0;
}

.pagination-info {
    color: #666;
    font-size: 14px;
    padding: 0 15px;
}

/* Real-time email animations */
@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
        background: #e3f2fd;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        background: white;
    }
}

.email-list {
    overflow-y: auto;
    flex: 1;
}

.email-item {
    display: block;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    cursor: pointer;
    background: white;
}

.email-item:hover {
    background: #f9f9f9;
}

.email-item.active {
    background: #e8f0fe;
    border-left: 3px solid #667eea;
}

.email-item:last-child {
    border-bottom: none;
}

.email-from {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.email-from strong {
    color: #333;
}

.email-badge {
    background: #e0e0e0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: #666;
}

.email-subject {
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
}

.email-snippet {
    color: #666;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 5px;
}

.email-date {
    color: #999;
    font-size: 12px;
}

/* Email View */
.email-view {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.email-header h2 {
    margin-bottom: 15px;
    color: #333;
}

.email-meta {
    padding: 15px 0;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

.email-meta div {
    margin-bottom: 5px;
    color: #666;
}

.email-body {
    line-height: 1.6;
}

.email-text {
    white-space: pre-wrap;
    font-family: inherit;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 4px;
}

/* Accounts */
.accounts-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.account-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.account-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.account-icon {
    font-size: 32px;
}

.account-details strong {
    display: block;
    margin-bottom: 3px;
}

.account-details small {
    display: block;
    color: #666;
    font-size: 12px;
}

/* Provider Cards */
.provider-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.provider-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.provider-card h3 {
    margin-bottom: 10px;
    color: #333;
}

.provider-card p {
    color: #666;
    margin-bottom: 20px;
}

/* Info Box */
.info-box {
    background: #e7f3ff;
    border-left: 4px solid #2196f3;
    padding: 20px;
    border-radius: 4px;
}

.info-box h4 {
    margin-bottom: 10px;
    color: #1976d2;
}

.info-box ul {
    margin-left: 20px;
    color: #333;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 16px;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 15px;
}

.mt-4 {
    margin-top: 20px;
}

.mb-3 {
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .provider-cards {
        grid-template-columns: 1fr;
    }
    
    .email-panes {
        flex-direction: column;
    }
    
    .email-list-pane {
        width: 100%;
        height: 50vh;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .email-preview-pane {
        height: 50vh;
    }
}
