/* =============================================
   IMAP Sync - Email Migration Tool Stylesheet
   ============================================= */

:root {
    --primary-color: #2563eb;
    /* Modern Blue */
    --primary-hover: #1d4ed8;
    --secondary-color: #10b981;
    /* Modern Green */
    --secondary-hover: #059669;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 40px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px;
    background: linear-gradient(135deg, var(--primary-color), #4f46e5);
    color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    animation: rotateBg 20s linear infinite;
    pointer-events: none;
}

@keyframes rotateBg {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

header h1 {
    font-size: 2.5em;
    font-weight: 800;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

header .subtitle {
    font-size: 1.1em;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

/* Form Columns */
.columns {
    display: flex;
    gap: 30px;
    align-items: stretch;
    flex-wrap: wrap;
    position: relative;
}

.column {
    flex: 1;
    min-width: 320px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.column:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.source-col {
    border-top: 5px solid var(--primary-color);
}

.dest-col {
    border-top: 5px solid var(--secondary-color);
}

.column h2 {
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.source-col h2 {
    color: var(--primary-color);
}

.dest-col h2 {
    color: var(--secondary-color);
}

/* Animation Container (Center) */
.sync-animation-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-width: 60px;
}

.sync-icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    color: var(--text-muted);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.sync-icon-wrapper:hover {
    color: var(--primary-color);
    transform: scale(1.1);
    border-color: var(--primary-color);
}

/* Active Sync Animation */
body.syncing .sync-icon-wrapper {
    animation: spin 2s linear infinite;
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: #eff6ff;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.2s;
    background: #f9fafb;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Helper Classes */
.form-row {
    display: flex;
    gap: 15px;
}

.form-group.half {
    flex: 1;
}

.password-wrapper {
    display: flex;
    position: relative;
}

.password-wrapper input {
    border-radius: 8px 0 0 8px !important;
}

.password-wrapper .toggle-pw {
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 8px 8px 0;
    background: #f3f4f6;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85em;
    color: var(--text-muted);
    transition: background 0.2s;
}

.password-wrapper .toggle-pw:hover {
    background: #e5e7eb;
}

/* Buttons */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-test {
    background: white;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    width: 100%;
    margin-top: auto;
    font-size: 0.9em;
}

.btn-test:hover:not(:disabled) {
    background: #f9fafb;
    border-color: var(--text-muted);
}

.btn-sync {
    background: var(--primary-color);
    color: white;
    font-size: 1.1em;
    padding: 16px 48px;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.btn-sync:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.3);
}

.btn-stop {
    background: var(--danger-color);
    color: white;
    padding: 16px 32px;
}

.btn-stop:hover:not(:disabled) {
    background: var(--danger-hover);
}

/* Advanced Settings */
.options-section {
    margin-top: 30px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.options-section summary {
    padding: 20px 30px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    background: #f9fafb;
    user-select: none;
    outline: none;
}

.options-section summary:hover {
    background: #f3f4f6;
}

.options-grid {
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.checkboxes label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 20px;
    cursor: pointer;
}

.checkboxes input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* Action Area */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

/* Animations during Sync */
body.syncing .btn-sync {
    position: relative;
    overflow: hidden;
}

body.syncing .btn-sync::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Progress Section */
.progress-section {
    margin-top: 30px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat {
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-label {
    font-size: 0.8em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.25em;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 5px;
}

.progress-bar-container {
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 25px;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85em;
    font-weight: 700;
    transition: width 0.4s ease;
    background-size: 200% 100%;
    animation: gradientMove 2s linear infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

/* Log */
.log-section {
    margin-top: 30px;
    background: #1f2937;
    /* Dark theme */
    color: #e5e7eb;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-md);
}

.log-section h2 {
    color: white;
    border-bottom: 1px solid #374151;
    padding-bottom: 15px;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.log-output {
    background: #111827;
    color: #10b981;
    /* Matrix Style Green */
    padding: 15px;
    border-radius: 8px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    max-height: 400px;
    overflow-y: auto;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 60px;
    color: var(--text-muted);
    font-size: 0.9em;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* Test Results */
.test-result {
    margin-top: 10px;
    font-size: 0.9em;
    border-radius: 6px;
}

.test-result.success {
    color: var(--secondary-color);
    background: #ecfdf5;
    padding: 10px;
    border: 1px solid #a7f3d0;
}

.test-result.error {
    color: var(--danger-color);
    background: #fef2f2;
    padding: 10px;
    border: 1px solid #fecaca;
}

/* Responsive */
@media (max-width: 768px) {
    .columns {
        flex-direction: column;
    }

    .sync-animation-container {
        transform: rotate(90deg);
        margin: 20px 0;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}


/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 30px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideDown 0.3s;
    color: var(--text-color);
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 0.8;
}

.close:hover,
.close:focus {
    color: var(--text-color);
    text-decoration: none;
}

.help-section {
    margin-bottom: 25px;
}

.help-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    margin-bottom: 12px;
    font-size: 1.1em;
}

.help-section .icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 0.85em;
    font-weight: bold;
}

.help-section p {
    margin-bottom: 10px;
    font-size: 0.95em;
}

.help-section ol {
    margin-left: 20px;
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.9em;
}

.help-section li {
    margin-bottom: 5px;
}

.btn-fill {
    padding: 8px 16px;
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-fill:hover {
    background: #d1d5db;
    color: #000;
}

hr {
    margin: 25px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Privacy Alert */
.privacy-alert {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    font-size: 0.9em;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
}

.privacy-alert p {
    margin-bottom: 5px;
}

.privacy-alert p:last-child {
    margin-bottom: 0;
}

.privacy-alert strong {
    font-weight: 700;
}