/**
 * Styles CSS pour le plugin Email Extractor
 * Version: 1.0.0
 */

/* Reset et base */
.email-extractor-container {
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

.email-extractor-container *,
.email-extractor-container *::before,
.email-extractor-container *::after {
    box-sizing: border-box;
}

/* En-tête */
.email-extractor-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    position: relative;
    overflow: hidden;
}

.email-extractor-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.email-extractor-title {
    margin: 0 0 0.75rem 0;
    font-size: 2.2rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

.email-extractor-description {
    margin: 0;
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* Sélecteur de source */
.email-extractor-source-selector {
    margin-bottom: 2rem;
}

.source-tabs {
    display: flex;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
    position: relative;
}

.source-tab {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    position: relative;
    z-index: 2;
}

.source-tab:hover {
    color: #495057;
    background: rgba(255,255,255,0.5);
}

.source-tab.active {
    background: white;
    color: #007cba;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
}

.tab-icon {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.source-tab.active .tab-icon {
    transform: scale(1.1);
}

/* Groupes d'entrée */
.email-extractor-inputs {
    margin-bottom: 2rem;
}

.input-group {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.input-group.active {
    display: block;
}

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

.input-label {
    display: block;
    margin-bottom: 0.75rem;
    color: #2c3e50;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.025em;
}

.input-wrapper {
    position: relative;
    margin-bottom: 0.75rem;
}

.form-input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1.25rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 4px rgba(0, 124, 186, 0.1);
    transform: translateY(-1px);
}

.form-input:hover {
    border-color: #dee2e6;
}

.text-field {
    resize: vertical;
    min-height: 140px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    line-height: 1.5;
    font-size: 0.95rem;
}

.input-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem;
    color: #adb5bd;
    pointer-events: none;
    transition: all 0.3s ease;
}

.form-input:focus + .input-icon {
    color: #007cba;
    transform: translateY(-50%) scale(1.1);
}

.input-help {
    display: block;
    color: #6c757d;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-top: 0.5rem;
    padding-left: 0.25rem;
}

/* Actions */
.email-extractor-actions {
    text-align: center;
    margin: 3rem 0;
}

.extract-button {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 1.25rem 2.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    min-width: 220px;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 14px rgba(0, 124, 186, 0.3);
}

.extract-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 124, 186, 0.4);
}

.extract-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 124, 186, 0.3);
}

.extract-button.loading {
    pointer-events: none;
    opacity: 0.8;
}

.extract-button.loading .button-text,
.extract-button.loading .button-icon {
    opacity: 0;
}

.button-loader {
    display: none;
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.extract-button.loading .button-loader {
    display: block;
}

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

/* Résultats */
.email-extractor-results {
    margin-top: 3rem;
    padding: 2rem;
    background: white;
    border-radius: 16px;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    animation: slideUp 0.4s ease-out;
}

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

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f8f9fa;
}

.results-title {
    color: #2c3e50;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.results-title::before {
    content: '📧';
    font-size: 1.3rem;
}

.results-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.email-count {
    font-weight: 800;
    font-size: 1.3rem;
}

.count-label {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* Actions des résultats */
.results-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.download-group {
    display: flex;
    gap: 0.75rem;
}

.action-button {
    padding: 0.75rem 1.5rem;
    border: 2px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
}

.action-button:hover {
    background: #f8f9fa;
    border-color: #007cba;
    color: #007cba;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.copy-button:hover {
    background: #e8f5e8;
    border-color: #28a745;
    color: #28a745;
}

.download-txt:hover {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.download-csv:hover {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

/* Liste des emails */
.email-list {
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    max-height: 450px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #dee2e6 #f8f9fa;
}

.email-list::-webkit-scrollbar {
    width: 8px;
}

.email-list::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}

.email-list::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 4px;
}

.email-list::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

.email-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    background: white;
}

.email-item:first-child {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.email-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.email-item:hover {
    background: #f0f8ff;
    transform: translateX(4px);
    border-left: 4px solid #007cba;
    padding-left: calc(1.5rem - 4px);
}

.email-address {
    color: #007cba;
    text-decoration: none;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.email-address:hover {
    text-decoration: underline;
    color: #005a87;
}

.email-copy-btn {
    opacity: 0;
    background: #007cba;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.email-item:hover .email-copy-btn {
    opacity: 1;
}

.email-copy-btn:hover {
    background: #005a87;
}

/* Messages */
.email-extractor-messages {
    margin-top: 1.5rem;
}

.message {
    padding: 1.25rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-left: 4px solid;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.message.success {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

.message-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.message-text {
    flex: 1;
    font-weight: 500;
}

/* États vides */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .email-extractor-container {
        padding: 0 1rem;
    }
    
    .email-extractor-header {
        padding: 1.5rem 1rem;
        margin-bottom: 2rem;
    }
    
    .email-extractor-title {
        font-size: 1.8rem;
    }
    
    .email-extractor-description {
        font-size: 1rem;
    }
    
    .source-tabs {
        flex-direction: column;
        gap: 4px;
    }
    
    .source-tab {
        padding: 1rem;
        border-radius: 8px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 1.5rem;
    }
    
    .results-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .download-group {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .extract-button {
        width: 100%;
        padding: 1.25rem 2rem;
    }
    
    .email-extractor-results {
        padding: 1.5rem;
    }
    
    .email-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .email-item:hover {
        transform: none;
        border-left: none;
        padding-left: 1rem;
    }
    
    .email-copy-btn {
        opacity: 1;
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .email-extractor-title {
        font-size: 1.5rem;
    }
    
    .form-input {
        padding: 1rem;
        padding-right: 3rem;
    }
    
    .input-icon {
        right: 1rem;
    }
    
    .extract-button {
        font-size: 1rem;
        padding: 1rem 1.5rem;
        min-width: auto;
    }
    
    .results-title {
        font-size: 1.3rem;
    }
    
    .action-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Animations d'amélioration */
.email-extractor-container {
    animation: containerFadeIn 0.6s ease-out;
}

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

/* Focus visible pour l'accessibilité */
.source-tab:focus-visible,
.extract-button:focus-visible,
.action-button:focus-visible,
.form-input:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    .email-extractor-container {
        color: #e9ecef;
    }
    
    .email-extractor-results {
        background: #2c3e50;
        border-color: #495057;
    }
    
    .email-list {
        background: #343a40;
        border-color: #495057;
    }
    
    .email-item {
        background: #495057;
        border-color: #6c757d;
    }
    
    .email-item:hover {
        background: #5a6268;
    }
    
    .form-input {
        background: #495057;
        border-color: #6c757d;
        color: #e9ecef;
    }
    
    .form-input:focus {
        border-color: #007cba;
        background: #5a6268;
    }
}

