* {
    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;
    color: #333;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 30px 0;
}

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

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.search-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

#emailSearch {
    flex: 1;
    min-width: 250px;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
}

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

.search-button {
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.search-icon {
    font-size: 1.2rem;
}

.results-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease;
}

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

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.email-header h2 {
    font-size: 1.5rem;
    color: #333;
    word-break: break-all;
}

.email-count {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #666;
    font-size: 1.1rem;
}

.emails-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.email-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
    cursor: pointer;
}

.email-item:hover {
    background: #f0f0f0;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.email-from {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.email-date {
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
}

.email-subject {
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
    word-break: break-word;
}

.email-preview {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stats-section {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 250px;
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-info {
    flex: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid #c33;
    margin-top: 15px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #666;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state-text {
    font-size: 1.1rem;
}

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

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 900px;
    max-height: 95vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    margin: auto;
    overflow: hidden; /* İçerik scroll edilecek */
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
    flex: 1;
    word-break: break-word;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0; /* Flexbox için önemli */
    max-height: calc(95vh - 140px); /* Header için alan bırak */
}

.modal-body::-webkit-scrollbar {
    width: 10px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.modal-info {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-from,
.modal-date {
    margin-bottom: 10px;
    color: #666;
    font-size: 0.95rem;
}

.modal-from strong,
.modal-date strong {
    color: #333;
    margin-right: 8px;
}

.modal-content-text {
    color: #333;
    line-height: 1.8;
    font-size: 1rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: visible; /* Scroll modal-body'de olacak */
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    min-height: 200px;
    width: 100%;
    box-sizing: border-box;
}

/* HTML içerikler için */
.modal-content-text img {
    max-width: 100%;
    height: auto;
}

.modal-content-text table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

.modal-content-text::-webkit-scrollbar {
    width: 8px;
}

.modal-content-text::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content-text::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.modal-content-text::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.email-item {
    position: relative;
}

.email-item::after {
    content: '👁️ Tam İçeriği Gör';
    position: absolute;
    bottom: 15px;
    right: 20px;
    font-size: 0.85rem;
    color: #667eea;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-weight: 600;
}

.email-item:hover::after {
    opacity: 1;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-button {
        width: 100%;
        justify-content: center;
    }

    .email-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .email-item-header {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body {
        padding: 20px;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }
}

