/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --success-color: #16a34a;
    --info-color: #0891b2;
    --warning-color: #ea580c;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.main-header {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.main-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

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

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #0e7490;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn.copied {
    background: var(--success-color);
}

/* Migration List */
.migration-list h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.migrations-table {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.migration-row {
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.2s;
}

.migration-row:hover {
    box-shadow: var(--shadow-md);
}

.migration-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    cursor: pointer;
}

.migration-info {
    flex: 1;
}

.migration-info h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.migration-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.meta-item {
    font-size: 14px;
    color: var(--text-secondary);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-in_progress {
    background: #dbeafe;
    color: #1e40af;
}

.badge-completed {
    background: #d1fae5;
    color: #065f46;
}

.badge-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.btn-expand {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}

.btn-expand:hover {
    background: var(--bg-color);
    transform: none;
    box-shadow: none;
}

.expand-icon {
    font-size: 16px;
}

/* Migration Details */
.migration-details {
    border-top: 1px solid var(--border-color);
    padding: 24px;
    background: var(--bg-color);
}

.details-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detail-section {
    background: var(--surface-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.detail-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

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

.section-header h4 {
    margin-bottom: 0;
}

/* Deadlines */
.deadlines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.deadline-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.deadline-item label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.deadline-3week label::before {
    content: '🟡 ';
}

.deadline-1week label::before {
    content: '🟠 ';
}

.deadline-migration label::before {
    content: '🔴 ';
}

/* Form Controls */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background: var(--surface-color);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:disabled {
    background: var(--bg-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Email List */
.email-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.email-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.email-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.email-address {
    font-weight: 500;
    color: var(--text-primary);
}

.password-badge {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #d1fae5;
    color: #065f46;
}

.password-badge-empty {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #fee2e2;
    color: #991b1b;
}

.email-actions {
    display: flex;
    gap: 8px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Text Utilities */
.text-muted {
    color: var(--text-muted);
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 16px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--surface-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s;
}

.modal-large .modal-content {
    max-width: 800px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

/* Templates */
.template-item {
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
}

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

.template-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.template-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.template-field strong {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.template-field p,
.template-field pre {
    background: var(--bg-color);
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.template-field pre {
    font-family: 'Courier New', monospace;
}

/* Calendar */
.calendar-container {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

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

.calendar-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.calendar-day-name {
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 8px;
}

.calendar-dates {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-date {
    aspect-ratio: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    background: var(--surface-color);
    position: relative;
    transition: all 0.2s;
}

.calendar-date.empty {
    border: none;
    background: transparent;
}

.calendar-date.has-events {
    border-color: var(--primary-color);
    cursor: pointer;
}

.calendar-date.has-events:hover {
    background: var(--bg-color);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.date-number {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.date-events {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    cursor: pointer;
}

.event-dot.deadline-3week {
    background: #eab308;
}

.event-dot.deadline-1week {
    background: #f97316;
}

.event-dot.deadline-migration {
    background: #dc2626;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-box h1 {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-box h2 {
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer small {
    color: var(--text-muted);
    font-size: 12px;
}

/* Settings Page */
.settings-container {
    max-width: 600px;
    margin: 0 auto;
}

.settings-box {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.settings-box h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.settings-box h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    margin-top: 32px;
    color: var(--text-primary);
}

.form-text {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.settings-info {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.settings-info p {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Portal Page */
.portal-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.portal-container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
}

.portal-login,
.portal-content {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.portal-header {
    text-align: center;
    margin-bottom: 32px;
}

.portal-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.portal-header h2 {
    font-size: 20px;
    font-weight: 500;
    color: var(--primary-color);
}

.portal-description {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.migration-info-box {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    border-left: 4px solid var(--primary-color);
}

.migration-info-box p {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.migration-info-box p:last-child {
    margin-bottom: 0;
}

.info-text {
    font-style: italic;
}

.credentials-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.credential-item {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.credential-email,
.credential-password {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.credential-password {
    margin-bottom: 0;
}

.credential-item strong {
    min-width: 80px;
    color: var(--text-secondary);
}

.email-value,
.password-value {
    font-family: 'Courier New', monospace;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

.btn-toggle-password,
.btn-copy {
    padding: 6px 12px;
    font-size: 13px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: var(--secondary-color);
    color: white;
    transition: all 0.2s;
}

.btn-toggle-password:hover,
.btn-copy:hover {
    background: #475569;
}

.btn-copy.copied {
    background: var(--success-color);
}

.portal-footer {
    margin-top: 32px;
    text-align: center;
}

/* Error and Success Messages */
.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--danger-color);
}

.success-message {
    background: #d1fae5;
    color: #065f46;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--success-color);
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: var(--success-color);
    color: white;
}

.notification-error {
    background: var(--danger-color);
    color: white;
}

.notification-info {
    background: var(--info-color);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .migration-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .deadlines-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .email-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .calendar-date {
        aspect-ratio: auto;
        min-height: 60px;
    }

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

@media print {
    body {
        background: white;
    }

    .btn,
    .portal-footer,
    .btn-toggle-password,
    .btn-copy {
        display: none !important;
    }

    .password-value {
        font-size: 14px;
    }
}
