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

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;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.main-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
}

@media (max-width: 968px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95em;
    transition: border-color 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
    width: 100%;
}

.btn:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6c757d;
    margin-top: 10px;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-collapse {
    background: #17a2b8;
    margin-top: 15px;
}

.btn-collapse:hover:not(:disabled) {
    background: #138496;
}

.email-display {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.email-address {
    font-size: 1.1em;
    font-weight: 600;
    color: #667eea;
    word-break: break-all;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.copy-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    white-space: nowrap;
}

.copy-btn:hover {
    background: #5568d3;
}

.refresh-btn {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: #667eea;
    color: white;
}

.delete-all-btn {
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.2s;
}

.delete-all-btn:hover {
    background: #dc3545;
    color: white;
}

.email-meta {
    font-size: 0.85em;
    color: #666;
}

.email-meta div {
    margin-bottom: 5px;
}

.auto-refresh {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.auto-refresh input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state p {
    font-size: 1.2em;
}

.search-filter-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 15px;
    padding-left: 40px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 20px;
}

.search-box input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.message-item {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.message-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateX(5px);
}

.message-item.selected {
    border-color: #667eea;
    background: #f0f2ff;
}

.message-from {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.message-subject {
    font-size: 1.1em;
    color: #667eea;
    margin-bottom: 5px;
}

.message-time {
    font-size: 0.85em;
    color: #999;
}

.message-detail-header {
    border-top: 1px solid #e0e0e0;
    padding-top: 15px;
    margin-top: 20px;
}

.detail-row {
    margin-bottom: 10px;
    font-size: 0.95em;
}

.detail-label {
    font-weight: 600;
    color: #666;
    display: inline-block;
    width: 80px;
}

.detail-value {
    color: #333;
}

.message-body {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    line-height: 1.6;
}

.message-body h3 {
    margin-bottom: 10px;
    color: #333;
}

.message-body pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.error {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.success {
    background: #efe;
    color: #3c3;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

