:root {
    --background: #0a0c10;
    --surface: #161920;
    --surface-hover: #1e2128;
    --border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    
    /* New gradient colors */
    --gradient-purple: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    --gradient-blue: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    --gradient-pink: linear-gradient(135deg, #db2777 0%, #f472b6 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --gradient-error: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    
    /* New accent colors */
    --primary-color: #7c3aed;
    --primary-hover: #8b5cf6;
    --primary-light: rgba(124, 58, 237, 0.1);
    --success: #10b981;
    --error: #ef4444;
    
    /* Shadows with color */
    --shadow-colored: 0 4px 12px rgba(124, 58, 237, 0.1);
    --shadow-success: 0 4px 12px rgba(16, 185, 129, 0.1);
    --shadow-error: 0 4px 12px rgba(239, 68, 68, 0.1);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--background);
    min-height: 100vh;
    letter-spacing: -0.025em;
}

.app {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    position: relative;
    backdrop-filter: blur(20px);
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.1), transparent 70%);
    pointer-events: none;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
    background: var(--gradient-purple);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo .material-icons-round {
    font-size: 1.75rem;
    background: var(--gradient-purple);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.email-display {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.email-box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.email-box:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-colored);
}

.email-box:hover .copy-button {
    opacity: 1;
    transform: translateX(0);
}

#current-email {
    flex: 1;
    word-break: break-all;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    letter-spacing: -0.025em;
    padding: 0.125rem 0;
    background: transparent;
    border: none;
}

.copy-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateX(10px);
}

.copy-button:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.copy-button.success {
    background: var(--gradient-success);
    color: white;
}

.copy-button .material-icons-round {
    font-size: 18px;
}

.email-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-colored);
}

.email-box:focus-within .copy-button {
    opacity: 1;
    transform: translateX(0);
}

.email-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    width: 100%;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--gradient-purple);
    border-radius: 0 4px 4px 0;
}

.main-content {
    display: flex;
    flex-direction: column;
    background: var(--background);
    position: relative;
    overflow: hidden;
}

.inbox-view, .message-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
}

.message-view {
    background: var(--background);
    transform: translateX(100%);
}

.message-view.active {
    transform: translateX(0);
}

.inbox-view.hide {
    transform: translateX(-100%);
}

.main-content::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.05), transparent 60%);
    pointer-events: none;
}

.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 1;
}

.inbox-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inbox-header h2::before {
    content: 'inbox';
    font-family: 'Material Icons Round';
    font-size: 1.25rem;
    background: var(--gradient-purple);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.inbox-status {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: var(--background);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.inbox-section {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--surface);
}

.inbox-section::-webkit-scrollbar {
    width: 6px;
}

.inbox-section::-webkit-scrollbar-track {
    background: var(--surface);
}

.inbox-section::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message-item {
    padding: 1rem 1.25rem;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 1rem;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.message-item:hover {
    background: var(--surface-hover);
    transform: translateX(4px);
}

.message-item:hover .message-subject {
    color: var(--primary-color);
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.message-item:hover .message-avatar {
    background: var(--gradient-purple);
    color: white;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.message-subject {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

.message-from {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-date {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.empty-state {
    height: 100%;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    gap: 1.5rem;
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(to bottom, var(--surface), var(--background));
    border-radius: 16px;
    box-shadow: inset 0 0 0 1px var(--border);
}

.empty-state .material-icons-round {
    font-size: 3.5rem;
    color: var(--primary-color);
    opacity: 0.8;
    background: var(--primary-light);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 0.5rem;
    animation: pulse 2s infinite ease-in-out;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: var(--gradient-purple);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--surface);
    border-radius: 24px;
    max-width: 700px;
    margin: 2rem auto;
    box-shadow: var(--shadow-colored);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--background);
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.3;
}

.modal-body {
    padding: 2rem;
}

.message-meta {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.message-meta p {
    margin: 0.5rem 0;
    color: var(--text-primary);
}

.message-meta strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-right: 0.5rem;
}

.message-meta span {
    color: var(--text-secondary);
}

.message-body {
    line-height: 1.7;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.message-body a {
    color: var(--primary-color);
    text-decoration: none;
}

.message-body a:hover {
    text-decoration: underline;
}

.message-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.close-modal {
    padding: 0.75rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    transform: rotate(90deg);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.more-button {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.message-content-view {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.message-title {
    margin-bottom: 2rem;
}

.message-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.message-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 2rem;
}

.sender-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sender-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sender-name {
    font-weight: 500;
    color: var(--text-primary);
}

.sender-address {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.message-body {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.9375rem;
}

#copy-email {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

#copy-email:hover {
    color: var(--text-primary);
    border-color: var(--primary-color);
    background: var(--primary-light);
}

#copy-email.success {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
}

button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

button.primary {
    background: var(--gradient-purple);
    color: white;
    font-weight: 600;
    box-shadow: var(--shadow-colored);
}

button.primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-colored);
}

button.primary:active {
    transform: translateY(0);
}

button:not(.primary) {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

button:not(.primary):hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.message-options {
    position: relative;
}

.options-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    min-width: 160px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
}

.options-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--surface-hover);
}

.dropdown-item.delete-message {
    color: #ef4444;
}

.dropdown-item.delete-message:hover {
    background: rgba(239, 68, 68, 0.1);
}

.dropdown-item.delete-message .material-icons-round {
    color: #ef4444;
}

.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    z-index: 1000;
}

.notification.success {
    background: var(--gradient-success);
    color: white;
    box-shadow: var(--shadow-success);
}

.notification.success .material-icons-round {
    color: var(--success);
}

.notification.error {
    background: var(--gradient-error);
    color: white;
    box-shadow: var(--shadow-error);
}

.notification.error .material-icons-round {
    color: var(--error);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .app {
        grid-template-columns: 1fr;
        min-height: 100vh;
        height: 100%;
    }

    .sidebar {
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .logo {
        font-size: 1.25rem;
    }

    .logo .material-icons-round {
        font-size: 1.5rem;
    }

    .email-box {
        flex-direction: row;
        align-items: center;
        padding: 0.625rem;
    }

    #current-email {
        font-size: 0.8125rem;
        padding: 0.25rem 0;
    }

    .copy-button {
        opacity: 1;
        transform: none;
        width: 28px;
        height: 28px;
    }

    .email-actions {
        padding-top: 0.75rem;
    }

    .nav-item {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }

    .main-content {
        padding: 1rem;
        height: calc(100vh - 200px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .inbox-messages {
        border-radius: 8px;
        overflow: hidden;
    }

    .message-item {
        padding: 0.875rem 1rem;
        gap: 0.75rem;
        grid-template-columns: 28px 1fr auto;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .message-subject {
        font-size: 0.8125rem;
    }

    .message-from {
        font-size: 0.75rem;
    }

    .message-date {
        font-size: 0.6875rem;
    }

    /* Message View Mobile Styles */
    .message-view {
        padding: 1rem;
        height: calc(100vh - 200px);
    }

    .message-header {
        padding: 1rem;
        gap: 0.75rem;
    }

    .message-content {
        padding: 1rem;
    }

    .back-button {
        padding: 0.5rem;
    }

    .message-options {
        position: relative;
    }

    .options-dropdown {
        position: absolute;
        right: 0;
        top: 100%;
        margin-top: 0.5rem;
        min-width: 140px;
    }

    /* Notification Mobile Styles */
    .notification {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        border-radius: 8px;
        padding: 0.875rem 1rem;
        font-size: 0.8125rem;
    }

    /* Empty State Mobile */
    .empty-state {
        padding: 2rem 1rem;
    }

    .empty-state h3 {
        font-size: 1.125rem;
    }

    .empty-state p {
        font-size: 0.8125rem;
    }

    /* Fix iOS Safari 100vh issue */
    @supports (-webkit-touch-callout: none) {
        .app {
            min-height: -webkit-fill-available;
        }
        
        .main-content,
        .message-view {
            height: calc(100vh - 200px);
            height: calc((var(--vh, 1vh) * 100) - 200px);
        }
    }
}

/* Small phones */
@media (max-width: 360px) {
    .sidebar {
        padding: 0.75rem;
    }

    .email-box {
        padding: 0.5rem;
    }

    #current-email {
        font-size: 0.75rem;
    }

    .message-item {
        padding: 0.75rem;
        gap: 0.5rem;
        grid-template-columns: 24px 1fr auto;
    }

    .message-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.6875rem;
    }

    .message-subject {
        font-size: 0.75rem;
    }

    .message-from,
    .message-date {
        font-size: 0.625rem;
    }
}

@media (max-width: 640px) {
    .app {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        grid-row: 1;
        grid-column: 1;
        padding: 1rem;
    }
    
    .main-content {
        grid-row: 2;
        grid-column: 1;
        padding: 1rem;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

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

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.4);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(var(--primary-rgb), 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}
