* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --secondary: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.3) 0%, transparent 50%);
    animation: pulse 15s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.login-section, .info-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-box, .info-box {
    background: white;
    border-radius: 24px;
    padding: 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.login-box:hover, .info-box:hover {
    transform: translateY(-5px);
}

.logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    text-align: center;
    color: var(--gray-900);
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
}

.subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 16px;
    margin-bottom: 32px;
}

.input-group {
    margin-bottom: 24px;
}

label {
    display: block;
    color: var(--gray-700);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: var(--gray-50);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.links {
    text-align: center;
    margin-top: 24px;
}

.links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.info-box h2 {
    color: var(--gray-900);
    margin-bottom: 24px;
    font-size: 28px;
    font-weight: 700;
}

.server-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
}

.info-item {
    background: var(--gray-50);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: start;
    gap: 16px;
    transition: all 0.3s ease;
}

.info-item:hover {
    background: var(--gray-100);
    transform: translateX(4px);
}

.info-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-item > div {
    flex: 1;
}

.info-item strong {
    color: var(--gray-800);
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}

code {
    background: var(--gray-800);
    color: var(--secondary);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    display: inline-block;
    font-size: 13px;
    margin-top: 4px;
    margin-right: 8px;
}

.security-status {
    background: var(--gray-50);
    padding: 24px;
    border-radius: 12px;
}

.security-status h3 {
    color: var(--gray-800);
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.2s ease;
}

.status-badge:hover {
    transform: scale(1.05);
}

.status-badge.success {
    background: #D1FAE5;
    color: #065F46;
}

.status-badge.warning {
    background: #FEF3C7;
    color: #92400E;
}

.dashboard-body {
    background: var(--gray-100);
}

.navbar {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-email {
    color: var(--gray-600);
    font-size: 14px;
}

.btn-logout {
    padding: 8px 20px;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
}

.welcome-section {
    margin-bottom: 40px;
}

.welcome-section h1 {
    text-align: left;
    font-size: 42px;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.welcome-section p {
    color: var(--gray-600);
    font-size: 18px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.dashboard-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.dashboard-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.card-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.card-icon.blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card-icon.green {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
}

.card-icon.orange {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
}

.card-icon.purple {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
}

.dashboard-card h3 {
    color: var(--gray-900);
    font-size: 20px;
    margin-bottom: 8px;
}

.dashboard-card p {
    color: var(--gray-600);
    font-size: 14px;
    margin-bottom: 16px;
}

.card-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.card-link:hover {
    color: var(--primary-dark);
}

.server-details {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.server-details h2 {
    font-size: 24px;
    color: var(--gray-900);
    margin-bottom: 24px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 8px;
}

.detail-label {
    font-weight: 600;
    color: var(--gray-700);
}

.detail-value {
    color: var(--gray-900);
    font-family: 'Courier New', monospace;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 40px;
    border-radius: 20px;
    max-width: 800px;
    position: relative;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    right: 24px;
    top: 24px;
    font-size: 32px;
    font-weight: bold;
    color: var(--gray-500);
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--gray-900);
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 640px) {
    .login-box, .info-box {
        padding: 32px 24px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .nav-content {
        flex-direction: column;
        gap: 16px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.auth-container {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.auth-box {
    background: white;
    border-radius: 24px;
    padding: 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
}

.checkbox-group {
    margin: 16px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-700);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.input-hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--gray-500);
}

.mail-container {
    display: flex;
    min-height: calc(100vh - 68px);
    max-width: 1600px;
    margin: 0 auto;
}

.mail-sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--gray-200);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}

.sidebar-compose-btn {
    background: var(--primary);
    color: white;
    padding: 14px 20px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.sidebar-compose-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.sidebar-menu {
    flex: 1;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--gray-700);
    text-decoration: none;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.sidebar-item:hover {
    background: var(--gray-100);
}

.sidebar-item.active {
    background: var(--primary);
    color: white;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.storage-info {
    font-size: 13px;
}

.storage-label {
    color: var(--gray-600);
    margin-bottom: 8px;
}

.storage-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.storage-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
}

.storage-text {
    color: var(--gray-500);
    font-size: 12px;
}

.mail-content {
    flex: 1;
    background: var(--gray-50);
    overflow-y: auto;
}

.mail-header {
    background: white;
    padding: 24px 32px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mail-header h1 {
    font-size: 28px;
    color: var(--gray-900);
    text-align: left;
}

.mail-actions {
    display: flex;
    gap: 12px;
}

.btn-compose, .btn-refresh, .btn-back, .btn-delete {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-compose {
    background: var(--primary);
    color: white;
}

.btn-compose:hover {
    background: var(--primary-dark);
}

.btn-refresh, .btn-back {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-refresh:hover, .btn-back:hover {
    background: var(--gray-200);
}

.btn-delete {
    background: var(--danger);
    color: white;
}

.btn-delete:hover {
    background: #DC2626;
}

.mail-stats {
    padding: 16px 32px;
    background: #EEF2FF;
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
}

.unread-badge {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.email-list {
    padding: 0;
}

.email-item {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.email-item:hover {
    background: var(--gray-50);
}

.email-item.unread {
    background: #F0F9FF;
}

.email-item.unread .email-subject {
    font-weight: 700;
}

.email-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.email-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.email-avatar.sent {
    background: var(--secondary);
}

.email-details {
    flex: 1;
    min-width: 0;
}

.email-from {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.email-subject {
    color: var(--gray-700);
    margin-bottom: 4px;
}

.email-preview {
    color: var(--gray-500);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.email-date {
    color: var(--gray-500);
    font-size: 14px;
}

.btn-delete-mini {
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-delete-mini:hover {
    background: #FEE2E2;
    color: var(--danger);
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state svg {
    margin-bottom: 24px;
}

.empty-state h3 {
    color: var(--gray-900);
    font-size: 20px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray-500);
}

.compose-form {
    max-width: 900px;
    margin: 32px auto;
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.compose-form .input-group {
    margin-bottom: 24px;
}

.compose-form label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.compose-form input[type="email"],
.compose-form input[type="text"],
.compose-form input[type="password"],
.compose-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.compose-form textarea {
    resize: vertical;
    min-height: 300px;
}

.compose-form input:focus,
.compose-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-cancel {
    padding: 12px 24px;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    background: var(--gray-200);
}

.email-view {
    max-width: 900px;
    margin: 32px auto;
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.email-view-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

.email-from-details {
    display: flex;
    gap: 16px;
}

.email-avatar-large {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 24px;
    flex-shrink: 0;
}

.email-from-name {
    font-weight: 700;
    font-size: 18px;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.email-to-name {
    color: var(--gray-500);
    font-size: 14px;
}

.email-date-large {
    color: var(--gray-500);
    font-size: 14px;
}

.email-body {
    line-height: 1.7;
    color: var(--gray-800);
}

.email-text {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.email-html {
    word-wrap: break-word;
}

.error-container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.error-box {
    background: white;
    border-radius: 24px;
    padding: 60px 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.error-code {
    font-size: 72px;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 16px;
}

.error-box h2 {
    font-size: 28px;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.error-box p {
    color: var(--gray-600);
    margin-bottom: 32px;
    font-size: 16px;
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .mail-container {
        flex-direction: column;
    }
    
    .mail-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }
    
    .mail-header {
        flex-direction: column;
        align-items: start;
        gap: 16px;
    }
    
    .compose-form, .email-view {
        margin: 16px;
        padding: 24px;
    }
}

