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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f4f8;
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1a2332 0%, #0d1520 100%);
    color: #c8d0dc;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.logo {
    padding: 0 24px 30px;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo i {
    color: #4fc3f7;
    font-size: 28px;
}

.nav-menu {
    padding: 20px 12px;
    flex: 1;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: #a0abbd;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s;
    margin-bottom: 4px;
    font-size: 15px;
}

.nav-menu a i {
    width: 24px;
    font-size: 18px;
    text-align: center;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.nav-menu a.active {
    background: rgba(79, 195, 247, 0.15);
    color: #4fc3f7;
    box-shadow: inset 3px 0 0 #4fc3f7;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
}

.top-bar {
    background: #fff;
    padding: 18px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e8edf3;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title h1 {
    font-size: 22px;
    font-weight: 600;
    color: #1a2332;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #4a5568;
}

.user-info i {
    font-size: 32px;
    color: #4fc3f7;
}

.content-body {
    padding: 28px 32px 40px;
}

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    overflow: hidden;
    max-width: 900px;
    margin: 0 auto;
}

.card-header {
    padding: 24px 32px;
    border-bottom: 1px solid #eef3f8;
}

.card-header h2 {
    font-size: 20px;
    color: #1a2332;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header h2 i {
    color: #4fc3f7;
}

.subtitle {
    color: #718096;
    font-size: 14px;
    margin-top: 4px;
}

/* ===== FORM ===== */
.migration-form {
    padding: 32px;
}

.form-section {
    margin-bottom: 28px;
}

.form-section h3 {
    font-size: 16px;
    color: #2d3748;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h3 i {
    color: #4fc3f7;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: #fafcfd;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4fc3f7;
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1);
}

.form-group input:disabled {
    background: #f7fafc;
    opacity: 0.7;
}

.password-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.password-wrapper input {
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    font-size: 16px;
    padding: 8px;
}

.toggle-password:hover {
    color: #4fc3f7;
}

.hint {
    display: block;
    font-size: 12px;
    color: #a0aec0;
    margin-top: 4px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 400;
    color: #2d3748;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4fc3f7;
    cursor: pointer;
}

/* ===== BUTTONS ===== */
.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #eef3f8;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background: #4fc3f7;
    color: #fff;
}

.btn-primary:hover {
    background: #3da9de;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 195, 247, 0.3);
}

.btn-secondary {
    background: #edf2f7;
    color: #2d3748;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* ===== PROGRESS ===== */
.progress-container {
    padding: 24px 32px 32px;
    border-top: 1px solid #eef3f8;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: #2d3748;
}

.progress-bar {
    height: 8px;
    background: #edf2f7;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4fc3f7, #2b9ed6);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-log {
    margin-top: 12px;
    max-height: 200px;
    overflow-y: auto;
    background: #f7fafc;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #4a5568;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===== RESULTS ===== */
.result-container {
    padding: 24px 32px 32px;
    border-top: 1px solid #eef3f8;
}

.success {
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    border-radius: 8px;
    padding: 20px;
}

.error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    padding: 20px;
    color: #e53e3e;
}

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

.size-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.size-item {
    background: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.size-item .label {
    display: block;
    font-size: 13px;
    color: #718096;
}

.size-item .value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin-top: 4px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 72px;
        padding: 12px 0;
    }
    
    .sidebar .logo span,
    .sidebar .nav-menu a span {
        display: none;
    }
    
    .sidebar .logo {
        padding: 0 12px 20px;
        justify-content: center;
    }
    
    .sidebar .logo i {
        font-size: 28px;
    }
    
    .nav-menu a {
        justify-content: center;
        padding: 14px;
    }
    
    .nav-menu a i {
        font-size: 22px;
        width: auto;
    }
    
    .main-content {
        margin-left: 72px;
    }
    
    .content-body {
        padding: 16px;
    }
    
    .migration-form {
        padding: 16px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        justify-content: center;
    }
}

/* ===== CSV SECTION ===== */
.csv-section {
    background: #f8fafc;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
}

.csv-upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.csv-upload-area:hover {
    border-color: #4fc3f7;
    background: #f0f7ff;
}

.csv-upload-area.highlight {
    border-color: #4fc3f7;
    background: #ebf8ff;
}

.csv-upload-content i {
    font-size: 48px;
    color: #4fc3f7;
    margin-bottom: 12px;
}

.csv-upload-content p {
    color: #4a5568;
    font-size: 16px;
    margin-bottom: 4px;
}

.csv-hint {
    display: block;
    color: #a0aec0;
    font-size: 13px;
    margin-bottom: 16px;
}

.csv-preview {
    margin-top: 16px;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.csv-preview h4 {
    margin-bottom: 12px;
    color: #2d3748;
}

.csv-preview-table-wrapper {
    max-height: 300px;
    overflow-y: auto;
}

.csv-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.csv-preview-table th {
    background: #f7fafc;
    padding: 8px 12px;
    text-align: left;
    font-weight: 500;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.csv-preview-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f7fafc;
}

.csv-preview-table tr:hover td {
    background: #f7fafc;
}

.badge-provider {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: #ebf8ff;
    color: #2b6cb0;
}

.csv-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-add-csv {
    background: #ebf8ff;
    border: 2px dashed #4fc3f7;
    border-radius: 10px;
    padding: 12px 20px;
    color: #2b6cb0;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-csv:hover {
    background: #bee3f8;
    border-color: #3182ce;
}

@media (max-width: 768px) {
    .csv-actions {
        flex-direction: column;
    }
    
    .btn-group {
        flex-direction: column;
    }
}

/* ===== РЕЗУЛЬТАТЫ ПРОВЕРКИ РАЗМЕРА ===== */
.size-total {
    background: #edf2f7;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.total-label {
    color: #4a5568;
    font-weight: 500;
    font-size: 14px;
}

.total-value {
    font-weight: 700;
    font-size: 18px;
    color: #2b6cb0;
}

.folders-details {
    margin-top: 10px;
    cursor: pointer;
}

.folders-details summary {
    color: #4a5568;
    font-size: 13px;
    padding: 4px 0;
}

.folders-list {
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 6px;
    margin-top: 6px;
    max-height: 150px;
    overflow-y: auto;
}

.folder-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #edf2f7;
    font-size: 13px;
}

.folder-item:last-child {
    border-bottom: none;
}

.folder-name {
    color: #2d3748;
    font-weight: 500;
}

.folder-size {
    color: #4a5568;
}

.folder-messages {
    color: #718096;
    font-size: 12px;
}

/* ===== КОМПАКТНЫЙ СПИСОК ЯЩИКОВ ===== */
.form-row-compact {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-group-compact {
    flex: 1;
    min-width: 0;
}

.form-group-compact label {
    display: block;
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 4px;
    font-size: 13px;
}

.form-group-compact input {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: #fafcfd;
    height: 38px;
}

.form-group-compact input:focus {
    outline: none;
    border-color: #4fc3f7;
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1);
}

.password-wrapper-compact {
    display: flex;
    align-items: center;
    position: relative;
}

.password-wrapper-compact input {
    padding-right: 38px;
}

.toggle-password-compact {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    font-size: 14px;
    padding: 6px;
}

.toggle-password-compact:hover {
    color: #4fc3f7;
}

.mailbox-entry {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.mailbox-entry:hover {
    border-color: #4fc3f7;
    box-shadow: 0 2px 8px rgba(79, 195, 247, 0.1);
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.entry-number {
    font-weight: 600;
    color: #2d3748;
    font-size: 13px;
}

.btn-remove {
    background: none;
    border: none;
    color: #fc8181;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-remove:hover {
    background: #fff5f5;
    color: #e53e3e;
}

.btn-add-compact {
    background: #edf2f7;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 8px 16px;
    width: 100%;
    color: #4a5568;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-add-compact:hover {
    background: #e2e8f0;
    border-color: #4fc3f7;
    color: #2b6cb0;
}

/* ===== АДАПТИВ ДЛЯ МОБИЛЬНЫХ ===== */
@media (max-width: 768px) {
    .form-row-compact {
        flex-direction: column;
        gap: 8px;
    }
    
    .mailbox-entry {
        padding: 12px;
    }
}

/* ===== КОМПАКТНОЕ ПРЕВЬЮ CSV ===== */
.csv-preview {
    margin-top: 12px;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.csv-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.csv-preview-header span {
    font-size: 14px;
    color: #2d3748;
}

.btn-close-preview {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 4px;
}

.btn-close-preview:hover {
    background: #f7fafc;
    color: #e53e3e;
}

.csv-preview-table-wrapper {
    max-height: 150px;
    overflow-y: auto;
}

.csv-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.csv-preview-table th {
    background: #f7fafc;
    padding: 4px 8px;
    text-align: left;
    font-weight: 500;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.csv-preview-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f7fafc;
    font-size: 13px;
}

.csv-preview-table tr:hover td {
    background: #f7fafc;
}

.csv-preview-footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eef3f8;
    color: #4a5568;
    font-size: 13px;
}