/* Sophie Lue Design System Variables */
:root {
    --sophie-bg: #0f0f14;
    --sophie-primary: #0f0f14;
    --sophie-secondary: #1a1a24;
    --sophie-accent: #4e54f4;
    --sophie-accent-secondary: #6abeee;
    --sophie-text: #ffffff;
    --sophie-light-text: #b3b3c9;
    --sophie-border: #2a2a3a;
    --sophie-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    --sophie-gradient: linear-gradient(135deg, #4e54f4, #9172f4);
    --sophie-radius: 12px;
    --sophie-transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--sophie-bg);
    color: var(--sophie-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.6;
    padding: 1rem 0;
}

/* Back to Sophie Link */
.back-to-sophie {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 100;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    color: var(--sophie-light-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--sophie-transition);
    backdrop-filter: blur(10px);
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--sophie-accent);
    color: var(--sophie-text);
    transform: translateX(-2px);
}

.back-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.back-link:hover svg {
    transform: translateX(-3px);
}

.container {
    background: linear-gradient(135deg, var(--sophie-secondary), #111118);
    border: 1px solid rgba(78, 84, 244, 0.2);
    padding: 2.5rem;
    border-radius: var(--sophie-radius);
    box-shadow: var(--sophie-shadow);
    max-width: 900px;
    width: 92%;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
    margin: 1rem auto;
}

.container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--sophie-gradient);
    border-radius: var(--sophie-radius) var(--sophie-radius) 0 0;
    z-index: 1;
}

h1 {
    color: var(--sophie-text);
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 2rem;
    background: var(--sophie-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

p {
    color: var(--sophie-light-text);
    margin-bottom: 2rem;
    line-height: 1.6;
    font-size: 1.1rem;
}

.btn-primary, .btn-secondary {
    padding: 14px 32px;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--sophie-transition);
    margin: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--sophie-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(78, 84, 244, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 84, 244, 0.4);
}

/* Login Options Container */
.login-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.login-title {
    color: var(--sophie-light-text);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* Email Provider Login Buttons */
.email-login-btn {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 4px;
    overflow: hidden;
}

.email-login-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4) !important;
}

.email-login-btn:active {
    transform: translateY(0) !important;
}

.login-image {
    width: 215px;
    height: 41px;
    display: block;
    cursor: pointer;
}

/* Legacy Microsoft Login Button (for backward compatibility) */
.ms-login-btn {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    transition: transform 0.2s ease;
}

.ms-login-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

.ms-login-image {
    width: 215px;
    height: 41px;
    display: block;
    cursor: pointer;
}

/* Google Sign-In Button */
.google-signin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #3c4043;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-width: 215px;
    height: 44px;
}

.google-signin-btn:hover {
    background: #f8f9fa;
    border-color: #c6c7ca;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.google-signin-btn:active {
    background: #f1f3f4;
    border-color: #bdc1c6;
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.google-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.google-btn-text {
    flex: 1;
    text-align: center;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sophie-light-text);
    border: 1px solid var(--sophie-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--sophie-text);
    border-color: var(--sophie-accent);
}

/* Animation enhancements */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.container {
    animation: fadeIn 0.6s ease-out;
}

#status-section {
    animation: slideIn 0.5s ease-out;
}

#results-section {
    animation: fadeIn 0.4s ease-out;
}

/* Header Section */
.header-section {
    position: relative;
    margin-bottom: 2.5rem;
}

.logo-section {
    margin-bottom: 2rem;
}

.tagline {
    font-size: 1.25rem;
    color: var(--sophie-accent-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.value-proposition {
    text-align: center;
    margin-bottom: 2rem;
}

.main-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--sophie-text);
    margin-bottom: 2.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    text-align: left;
}

.feature-item {
    background: rgba(30, 30, 45, 0.4);
    border: 1px solid rgba(78, 84, 244, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    transition: var(--sophie-transition);
}

.feature-item:hover {
    transform: translateY(-4px);
    border-color: rgba(78, 84, 244, 0.5);
    box-shadow: 0 8px 20px rgba(78, 84, 244, 0.2);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.feature-item h3 {
    color: var(--sophie-text);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-item p {
    color: var(--sophie-light-text);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.header-section::after {
    content: "";
    position: absolute;
    bottom: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--sophie-gradient);
    border-radius: 3px;
}

#status-section {
    margin-top: 2rem;
}

#status-message {
    margin: 1rem 0;
    padding: 1.2rem;
    background: rgba(78, 84, 244, 0.1);
    border: 1px solid rgba(78, 84, 244, 0.2);
    border-radius: var(--sophie-radius);
    color: var(--sophie-text);
    border-left: 4px solid var(--sophie-accent);
}

#progress-bar {
    width: 100%;
    height: 8px;
    background: var(--sophie-border);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

#progress-fill {
    height: 100%;
    background: var(--sophie-gradient);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.date-filter {
    margin: 1rem 0; /* Reduced from default */
    padding: 1.5rem;
    background: rgba(30, 30, 45, 0.6);
    border-radius: var(--sophie-radius);
    border: 1px solid var(--sophie-border);
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.date-filter:hover {
    border-color: rgba(78, 84, 244, 0.3);
    transform: translateY(-2px);
}

.date-filter label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--sophie-text);
}

.date-filter input {
    width: 100%;
    max-width: 200px;
    padding: 12px 16px;
    border: 1px solid var(--sophie-border);
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    color: var(--sophie-text);
}

.date-filter input:focus {
    outline: none;
    border-color: var(--sophie-accent);
    box-shadow: 0 0 0 3px rgba(78, 84, 244, 0.1);
}

.date-filter input::placeholder {
    color: var(--sophie-light-text);
}

.date-filter small {
    display: block;
    color: var(--sophie-light-text);
    font-size: 0.85em;
}

.controls {
    margin: 1.5rem 0; /* Reduced vertical margin */
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.realtime-sync {
    padding: 12px 24px;
    border: 1px solid var(--sophie-border);
    border-radius: 30px;
    background: transparent;
    color: var(--sophie-text);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--sophie-transition);
    position: relative;
    overflow: hidden;
}

.realtime-sync:hover {
    border-color: rgba(78, 84, 244, 0.3);
    transform: translateY(-2px);
}

.realtime-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sophie-text);
    background: rgba(78, 84, 244, 0.1);
    position: relative;
}

.realtime-status.active {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(52, 211, 153, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    }
}

.user-info {
    padding: 0.8rem; /* Reduced from 1rem */
    border: 1px solid var(--sophie-border);
    border-radius: var(--sophie-radius);
    background: rgba(30, 30, 45, 0.6);
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.user-info:hover {
    border-color: rgba(106, 190, 238, 0.4);
    transform: translateY(-2px);
}

/* Security Note */
.security-note {
    display: block;
    margin-top: 1rem;
    color: var(--sophie-accent-secondary);
    font-size: 0.9em;
    opacity: 0.9;
}

/* Status Header */
.status-header {
    margin-bottom: 1rem; /* Reduced from 1.5rem */
}

.status-header h3 {
    color: var(--sophie-accent-secondary);
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Enhanced button icons */
.btn-primary svg,
.btn-secondary svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 16px;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Enhanced scrollbar for results */
#results-content::-webkit-scrollbar {
    width: 8px;
}

#results-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#results-content::-webkit-scrollbar-thumb {
    background: var(--sophie-accent);
    border-radius: 4px;
}

#results-content::-webkit-scrollbar-thumb:hover {
    background: var(--sophie-accent-secondary);
}

/* Scrollbar Styling */
.subscriptions-container::-webkit-scrollbar,
.emails-container::-webkit-scrollbar {
    width: 6px;
}

.subscriptions-container::-webkit-scrollbar-track,
.emails-container::-webkit-scrollbar-track {
    background: rgba(42, 42, 58, 0.3);
    border-radius: 3px;
}

.subscriptions-container::-webkit-scrollbar-thumb,
.emails-container::-webkit-scrollbar-thumb {
    background: var(--sophie-accent);
    border-radius: 3px;
}

.subscriptions-container::-webkit-scrollbar-thumb:hover,
.emails-container::-webkit-scrollbar-thumb:hover {
    background: var(--sophie-accent-secondary);
}

/* Subscription status card */
.subscription-status-card {
    background: var(--sophie-secondary);
    border-radius: var(--sophie-radius);
    padding: 28px;
    margin: 20px 0;
    box-shadow: var(--sophie-shadow);
    transition: var(--sophie-transition);
    position: relative;
    overflow: hidden;
    color: var(--sophie-text);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.subscription-status-card:hover {
    transform: translateY(-2px);
    border-color: rgba(78, 84, 244, 0.3);
    box-shadow: 0 12px 30px rgba(78, 84, 244, 0.15);
}

.subscription-status-card h4 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--sophie-text);
    font-weight: 600;
    font-size: 18px;
    background: var(--sophie-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subscription-details {
    font-size: 14px;
}

.subscription-details p {
    margin: 12px 0;
    color: var(--sophie-light-text);
    line-height: 1.6;
}

.subscription-details p strong {
    color: var(--sophie-text);
    font-weight: 500;
}

.subscription-id {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--sophie-accent);
    background: rgba(78, 84, 244, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(78, 84, 244, 0.2);
}

.btn-warning {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    margin-top: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--sophie-transition);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    background: linear-gradient(135deg, #ff5252, #ff4444);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    margin-top: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--sophie-transition);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
    background: linear-gradient(135deg, #c82333, #bd2130);
}

.subscription-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.subscription-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(78, 84, 244, 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
}

.subscription-info p {
    margin: 4px 0;
    font-size: 13px;
}

.subscriptions-list {
    margin-top: 16px;
}

/* Email Cards Styling - DemoCRM inspired */
.emails-container {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Increased from 16px to 20px */
}

.no-emails-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--sophie-light-text);
}

.email-card {
    background: var(--sophie-secondary);
    border-radius: var(--sophie-radius);
    padding: 28px; /* Increased from 24px to 28px */
    box-shadow: var(--sophie-shadow);
    transition: var(--sophie-transition);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    min-height: 140px; /* Increased from 120px to 140px */
}

.email-card:hover {
    transform: translateY(-2px);
    border-color: rgba(78, 84, 244, 0.3);
    box-shadow: 0 12px 30px rgba(78, 84, 244, 0.15);
}

.email-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px; /* Increased from 16px to 20px */
    gap: 16px; /* Added gap to ensure spacing */
    min-height: 45px; /* Increased from 40px to 45px */
}

.email-subject {
    flex: 1; /* Allow subject to take available space */
    min-width: 0; /* Prevent flex item from overflowing */
}

.email-subject h4 {
    color: var(--sophie-text);
    font-weight: 600;
    font-size: 16px;
    margin: 0 0 8px 0;
    line-height: 1.4;
    word-wrap: break-word; /* Handle long subjects */
}

.email-meta {
    display: flex;
    gap: 16px; /* Increased gap from 12px to 16px */
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.email-date {
    color: var(--sophie-light-text);
    font-size: 13px;
}

.email-importance {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.email-status {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    min-width: fit-content; /* Ensure status badge doesn't get cut off */
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.read {
    background: rgba(106, 190, 238, 0.2);
    color: var(--sophie-accent-secondary);
    border: 1px solid rgba(106, 190, 238, 0.3);
}

.status-badge.unread {
    background: rgba(78, 84, 244, 0.2);
    color: var(--sophie-accent);
    border: 1px solid rgba(78, 84, 244, 0.3);
}

.email-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px; /* Increased gap from 10px to 12px */
}

.email-from,
.email-attachments {
    display: flex;
    align-items: center;
    gap: 10px; /* Increased gap from 8px to 10px */
    color: var(--sophie-light-text);
    font-size: 14px;
    line-height: 1.4;
}

.email-from svg,
.email-attachments svg {
    color: var(--sophie-accent);
    flex-shrink: 0;
}

.email-attachments {
    color: var(--sophie-accent-secondary);
}

/* Email Preview Modal */
.email-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.email-modal-content {
    background: var(--sophie-secondary);
    border: 1px solid rgba(78, 84, 244, 0.3);
    border-radius: var(--sophie-radius);
    box-shadow: var(--sophie-shadow);
    margin: 5% auto;
    padding: 2rem;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

.email-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.email-modal-title {
    color: var(--sophie-text);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    padding-right: 1rem;
}

.email-modal-close {
    background: none;
    border: none;
    color: var(--sophie-light-text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--sophie-transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.email-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sophie-text);
}

.email-modal-info {
    margin-bottom: 1.5rem;
}

.email-modal-info-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.email-modal-info-label {
    color: var(--sophie-light-text);
    font-weight: 500;
    min-width: 80px;
    margin-right: 1rem;
}

.email-modal-info-value {
    color: var(--sophie-text);
    flex: 1;
}

.email-modal-body {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.5rem;
    color: var(--sophie-text);
    line-height: 1.6;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.email-modal-badges {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.email-modal-badge {
    background: var(--sophie-accent);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.email-modal-badge.unread {
    background: #ff6b6b;
}

.email-modal-badge.attachments {
    background: var(--sophie-accent-secondary);
}

.email-modal-badge.high-importance {
    background: #ff6b6b;
}

.email-modal-badge.low-importance {
    background: #6abeee;
}

.email-card {
    cursor: pointer;
}

.email-card:hover {
    transform: translateY(-2px);
    border-color: rgba(78, 84, 244, 0.3);
    box-shadow: 0 12px 30px rgba(78, 84, 244, 0.15);
}

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

/* Mobile responsiveness for modal */
@media (max-width: 768px) {
    .email-modal-content {
        width: 95%;
        margin: 2% auto;
        padding: 1.5rem;
        max-height: 90vh;
    }
    
    .email-modal-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .email-modal-title {
        padding-right: 0;
        margin-bottom: 1rem;
    }
    
    .email-modal-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
    
    .email-modal-info-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .email-modal-info-label {
        margin-bottom: 0.3rem;
    }
}

/* Subtle gradient background pattern */
.container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(rgba(78, 84, 244, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: -1;
}

.subscription-description {
    margin-bottom: 1.5rem;
    text-align: left;
}

.subscription-description p {
    margin-bottom: 1rem; /* Reduced margin */
    font-size: 1rem; /* Slightly smaller text */
    color: var(--sophie-light-text);
}

.subscription-description ul {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0;
}

.subscription-description li {
    margin-bottom: 0.5rem;
    color: var(--sophie-light-text);
    padding-left: 1rem;
    position: relative;
}

.subscription-description li::before {
    content: "•";
    color: var(--sophie-accent);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.subscription-description em {
    color: var(--sophie-accent-secondary);
    font-style: italic;
    font-size: 0.9rem;
}

.subscription-controls {
    margin-bottom: 1rem;
}

.small-text {
    font-size: 0.85rem;
    color: #777;
}

.dashboard-section {
    margin-bottom: 1.5rem; /* Reduced spacing between sections */
}

.dashboard-section h3 {
    margin-bottom: 0.8rem; /* Reduced from 1rem */
    font-size: 1.1rem;
}

/* Token Status Styles for Personal Account Support */
.token-status {
    margin-top: 0.5rem;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.token-status-good {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.token-status-limited {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.token-warning {
    margin-top: 0.8rem;
    padding: 0.8rem;
    border-radius: 8px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    font-size: 0.85rem;
    text-align: left;
}

.token-warning.urgent {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.token-warning p {
    margin: 0;
}

.btn-warning-inline {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: 0.5rem;
    transition: var(--sophie-transition);
}

.btn-warning-inline:hover {
    background: rgba(251, 191, 36, 0.3);
    border-color: rgba(251, 191, 36, 0.5);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 0.5rem 0;
    }
    
    .back-to-sophie {
        position: static;
        width: 100%;
        padding: 1rem;
        background: var(--sophie-bg);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .back-link {
        width: 100%;
        justify-content: center;
    }
    
    .container {
        padding: 1.5rem;
        width: 95%;
        max-width: 100%;
        margin: 0.5rem auto;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .main-description {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 1.5rem 0;
    }
    
    .feature-item {
        padding: 1.25rem;
    }
    
    .feature-icon {
        font-size: 1.75rem;
    }
    
    .feature-item h3 {
        font-size: 0.95rem;
    }
    
    .feature-item p {
        font-size: 0.85rem;
    }
    
    .login-options {
        gap: 0.75rem;
    }
    
    .login-title {
        font-size: 0.95rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 12px 24px;
        font-size: 15px;
    }
    
    .date-filter {
        padding: 1.25rem;
    }
    
    .date-filter input {
        max-width: 100%;
    }
    
    .email-card {
        padding: 1.25rem;
    }
    
    .email-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .email-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .dashboard-section h3 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1.25rem;
        border-radius: 8px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .tagline {
        font-size: 0.9rem;
    }
    
    .main-description {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .feature-item {
        padding: 1rem;
    }
    
    .login-image,
    .ms-login-image {
        width: 180px;
        height: auto;
    }
    
    .google-signin-btn {
        min-width: 180px;
        padding: 10px 20px;
        font-size: 14px;
    }
}