* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    padding: 20px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header h1 i {
    margin-right: 15px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.main-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    margin-bottom: 20px;
}

.email-section {
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.email-box {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
}

.email-display {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.email-display i {
    font-size: 1.5em;
}

#tempEmail {
    flex: 1;
    font-size: 1.3em;
    font-weight: 600;
    word-break: break-all;
    min-width: 200px;
}

.copy-btn, .refresh-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1em;
}

.copy-btn:hover, .refresh-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.email-status {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    font-size: 0.9em;
    display: none;
}

.email-status.show {
    display: block;
}

.email-status.success {
    background: rgba(76, 175, 80, 0.3);
}

.email-status.error {
    background: rgba(244, 67, 54, 0.3);
}

.info-box {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.1);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.95em;
}

.info-item i {
    font-size: 1.2em;
}

.emails-section {
    padding: 30px;
}

.emails-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.emails-header h2 {
    color: #667eea;
    font-size: 1.8em;
}

.emails-header h2 i {
    margin-right: 10px;
}

.check-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.check-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.check-btn:active {
    transform: translateY(0);
}

.check-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.emails-list {
    max-height: 600px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1em;
}

.email-item {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.email-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.email-item-subject {
    font-weight: 600;
    font-size: 1.1em;
    color: #333;
    flex: 1;
}

.email-item-date {
    color: #666;
    font-size: 0.9em;
}

.email-item-from {
    color: #667eea;
    font-weight: 500;
    margin-bottom: 8px;
}

.email-item-preview {
    color: #666;
    font-size: 0.95em;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.email-viewer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

.viewer-content {
    background: white;
    border-radius: 15px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.viewer-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viewer-header h3 {
    flex: 1;
    margin-right: 20px;
}

.close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.viewer-meta {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.meta-item {
    margin-bottom: 10px;
    color: #666;
}

.meta-item:last-child {
    margin-bottom: 0;
}

.meta-item strong {
    color: #333;
    margin-right: 10px;
}

.viewer-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
    line-height: 1.6;
}

.viewer-body iframe {
    width: 100%;
    border: none;
    min-height: 400px;
}

.viewer-footer {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: none; /* Hidden on desktop, shown on mobile */
}

.back-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.back-btn:active {
    transform: translateY(0);
}

footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.8;
}

/* Scrollbar Styling */
.emails-list::-webkit-scrollbar,
.viewer-body::-webkit-scrollbar {
    width: 8px;
}

.emails-list::-webkit-scrollbar-track,
.viewer-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.emails-list::-webkit-scrollbar-thumb,
.viewer-body::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.emails-list::-webkit-scrollbar-thumb:hover,
.viewer-body::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Responsive Design - Mobile/Android Friendly */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header {
        padding: 15px 10px;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    header .subtitle {
        font-size: 0.95em;
    }
    
    .email-section {
        padding: 20px 15px;
    }
    
    .email-box {
        padding: 20px 15px;
    }
    
    .email-display {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .email-display i {
        font-size: 1.3em;
        align-self: center;
    }
    
    #tempEmail {
        width: 100%;
        font-size: 1.1em;
        text-align: center;
        word-break: break-all;
        padding: 10px 0;
    }
    
    .copy-btn, .refresh-btn {
        width: 100%;
        padding: 12px;
        justify-content: center;
        font-size: 1em;
    }
    
    .info-box {
        flex-direction: column;
        gap: 10px;
    }
    
    .info-item {
        width: 100%;
        justify-content: center;
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .emails-section {
        padding: 20px 15px;
    }
    
    .emails-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .emails-header h2 {
        font-size: 1.5em;
        text-align: center;
    }
    
    .check-btn {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }
    
    .email-item {
        padding: 15px;
        margin-bottom: 12px;
    }
    
    .email-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .email-item-subject {
        font-size: 1em;
        width: 100%;
    }
    
    .email-item-date {
        font-size: 0.85em;
        width: 100%;
    }
    
    .email-item-from {
        font-size: 0.9em;
        margin-bottom: 10px;
    }
    
    .email-item-preview {
        font-size: 0.9em;
    }
    
    /* Mobile: Full screen email viewer like a new page */
    .email-viewer {
        padding: 0;
        background: white;
        align-items: stretch;
    }
    
    .viewer-content {
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .viewer-header {
        padding: 15px;
        flex-shrink: 0;
    }
    
    .viewer-header h3 {
        font-size: 1.1em;
        margin-right: 10px;
    }
    
    /* Hide close button on mobile, show back button instead */
    .close-btn {
        display: none;
    }
    
    .viewer-meta {
        padding: 15px;
        flex-shrink: 0;
    }
    
    .viewer-body {
        padding: 20px 15px;
        flex: 1;
        overflow-y: auto;
    }
    
    /* Show back button on mobile */
    .viewer-footer {
        display: block;
        flex-shrink: 0;
    }
    
    .empty-state {
        padding: 40px 15px;
    }
    
    .empty-state i {
        font-size: 3em;
    }
    
    .empty-state p {
        font-size: 1em;
    }
    
    footer {
        padding: 15px 10px;
        font-size: 0.9em;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }
    
    .subtitle {
        font-size: 0.85em;
    }
    
    #tempEmail {
        font-size: 1em;
    }
    
    .email-section {
        padding: 15px 10px;
    }
    
    .email-box {
        padding: 15px 10px;
    }
    
    .emails-section {
        padding: 15px 10px;
    }
}

/* Loading Animation */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

