* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    background: linear-gradient(135deg, #2f3136 0%, #1a1b1e 100%);
    min-height: 100vh;
    padding: 0;
    color: #333;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 100%;
    min-height: 100vh;
    margin: 0 auto;
    background: transparent;
    display: flex;
    flex-direction: column;
}

header {
    background: transparent;
    color: white;
    padding: 30px 40px 20px 40px;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    flex: 1;
    text-align: center;
}

header h1 {
    font-size: 2em;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1em;
    opacity: 0.85;
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 15px;
}

.btn-header {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-header:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.btn-header-primary {
    background: rgba(255, 255, 255, 0.9);
    color: #2d5a7b;
    border-color: transparent;
}

.btn-header-primary:hover {
    background: white;
}

.btn-header-back {
    padding: 10px 20px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-header-back:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 40px 40px 40px;
}

.email-generator {
    background: #fafafa;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.email-input-section {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-bottom: 0;
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.email-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    transition: all 0.2s;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-weight: 500;
    color: #111827;
}

.email-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.email-input.valid {
    border-color: #10b981;
    background: #f0fdf4;
}

.email-input.invalid {
    border-color: #ef4444;
    background: #fef2f2;
}

.input-hint {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 20px;
    padding: 0;
}

.btn-icon {
    padding: 16px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    min-width: 52px;
}

.btn-icon:hover {
    background: white;
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-1px);
}

.btn-icon:active {
    transform: translateY(0);
}

.button-group {
    display: flex;
    gap: 12px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: transparent;
    color: #3b82f6;
    border: 2px solid #3b82f6;
}

.btn-secondary:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.domains-section {
    background: #fafafa;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.domains-section h2 {
    margin-bottom: 24px;
    color: #111827;
    font-size: 1.5em;
    font-weight: 600;
}

.domain-controls {
    margin-bottom: 24px;
}

.domain-search {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    margin-bottom: 16px;
    transition: all 0.2s;
    color: #111827;
}

.domain-search:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.category-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 10px 20px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    color: #6b7280;
}

.category-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: white;
}

.category-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.domains-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.domain-item {
    padding: 16px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.domain-item:hover {
    border-color: #3b82f6;
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.domain-item.popular {
    border-color: #f59e0b;
    background: #fffbeb;
}

.domain-item.popular:hover {
    border-color: #f59e0b;
    background: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.domain-name {
    font-weight: 600;
    margin-bottom: 6px;
    color: #111827;
    font-size: 14px;
}

.domain-category {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.domain-lifetime {
    font-size: 11px;
    color: #9ca3af;
}

.inbox-section {
    background: #fafafa;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.inbox-section.hidden {
    display: none;
}

.inbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f3f4f6;
}

.inbox-header h2 {
    flex: 1;
    text-align: left;
    font-size: 1.25em;
    color: #111827;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.btn-back {
    padding: 10px 20px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    color: #6b7280;
}

.btn-back:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: white;
}

.inbox-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-share {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.btn-share:hover {
    background: #059669;
    border-color: #059669;
}

.btn-delete-all {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.btn-delete-all:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.emails-list {
    max-height: 700px;
    overflow-y: auto;
}

/* Контейнер для двухколоночного просмотра (список + детальный просмотр) */
.email-view-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    max-height: 700px;
}

.email-list-column {
    overflow-y: auto;
    padding-right: 8px;
}

/* Кастомный скроллбар */
.email-list-column::-webkit-scrollbar {
    width: 6px;
}

.email-list-column::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 10px;
}

.email-list-column::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.email-list-column::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.email-detail-column {
    overflow-y: auto;
    padding-left: 8px;
}

.email-detail-column::-webkit-scrollbar {
    width: 6px;
}

.email-detail-column::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 10px;
}

.email-detail-column::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.email-detail-column::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Пустое состояние когда письмо не выбрано */
.email-detail-empty {
    background: #f9fafb;
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    padding: 80px 30px;
    text-align: center;
    color: #9ca3af;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.email-detail-empty-icon {
    font-size: 72px;
    margin-bottom: 20px;
    opacity: 0.6;
    filter: grayscale(0.3);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.email-detail-empty p {
    font-size: 16px;
    color: #9ca3af;
    margin: 0;
    font-weight: 500;
}

/* Стили для элемента письма в списке */
.email-item {
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.email-item:hover {
    border-color: #6b7280;
    background: #fafafa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.email-item.selected {
    background: #f3f4f6;
    border-color: #4b5563;
    border-width: 1px;
}

.email-item.selected .email-from,
.email-item.selected .email-subject {
    color: #1f2937;
}

.email-item.selected .email-date,
.email-item.selected .email-preview {
    color: #4b5563;
}

.email-item.unread {
    background: #fafafa;
    border-color: #e5e7eb;
    font-weight: 600;
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 6px;
}

.email-from {
    font-weight: 600;
    color: #111827;
    font-size: 13px;
}

.email-date {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    margin-left: 10px;
}

.email-subject {
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 4px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-preview {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Детальный просмотр письма */
.email-detail {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    min-height: 500px;
}

.email-detail-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.email-detail-header-content {
    display: flex;
    justify-content: space-between;
    align-items: start;
    position: relative;
}

.btn-close-email {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    background: #fafafa;
    color: #6b7280;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-close-email:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    transform: rotate(90deg);
}

/* Кнопки действий в детальном просмотре */
.email-detail-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Круглая кнопка удаления письма */
.btn-delete-email-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    background: #fafafa;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-delete-email-icon:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    transform: scale(1.1);
}

/* Квадратная кнопка удаления всех писем */
.btn-delete-all-square {
    background: #fee2e2 !important;
    border-color: #fecaca !important;
    color: #dc2626 !important;
}

.btn-delete-all-square:hover {
    background: #ef4444 !important;
    border-color: #dc2626 !important;
    color: white !important;
    transform: translateY(-2px);
}

.email-detail-from {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
    margin-bottom: 4px;
}

.email-detail-date {
    font-size: 12px;
    color: #6b7280;
}

.email-detail-subject {
    font-size: 18px;
    color: #111827;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
    line-height: 1.4;
}

.email-detail-body {
    margin-top: 16px;
    line-height: 1.8;
    color: #374151;
    min-height: 200px;
}

/* iframe для HTML писем (как у 24.email) */
.email-html-iframe {
    width: 100%;
    min-height: 800px;
    border: none;
    border-radius: 8px;
    background: white;
}

.email-text-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 15px;
    color: #374151;
}

.email-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
}

.btn-delete-email {
    padding: 10px 20px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-delete-email:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-delete-email:active {
    transform: translateY(0);
}

.loading, .empty {
    text-align: center;
    padding: 60px 40px;
    color: #9ca3af;
    font-size: 16px;
}

.hidden {
    display: none !important;
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1f2937;
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

footer {
    background: transparent;
    padding: 30px 40px;
    text-align: center;
}

footer nav {
    display: flex;
    justify-content: center;
    gap: 30px;
}

footer a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 14px;
}

footer a:hover {
    color: white;
}

/* Модальное окно "Поделиться" */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background: #fafafa;
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #9ca3af;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
}

.share-link-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.share-link-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    color: #1f2937;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s;
}

.share-link-input:hover {
    border-color: #3b82f6;
    background: white;
}

.share-link-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
}

.btn-copy-share {
    padding: 12px;
    background: #3b82f6;
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-copy-share:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-copy-share:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    body {
        padding: 0;
    }

    header {
        padding: 20px;
    }

    header h1 {
        font-size: 1.5em;
    }

    main {
        padding: 20px;
    }

    .email-generator, .domains-section, .inbox-section {
        padding: 24px;
    }
    
    /* Уменьшаем поле ввода чтобы кнопка крестика не выпирала */
    .input-group {
        gap: 6px;
    }
    
    .email-input {
        font-size: 14px;
        padding: 12px 14px;
    }
    
    .btn-icon {
        width: 38px;
        height: 38px;
        flex-shrink: 0;
    }

    .domains-list {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .inbox-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .inbox-header h2 {
        text-align: center;
        font-size: 1em;
    }

    /* На мобильных: список писем занимает весь экран */
    .email-view-container {
        grid-template-columns: 1fr;
        position: relative;
    }

    .email-list-column {
        padding-right: 0;
        max-height: none;
    }

    /* Детальный просмотр письма на весь экран */
    .email-detail-column {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        background: #fafafa;
        padding: 0;
        display: none;
    }
    
    /* Показываем детали письма только когда оно выбрано */
    .email-view-container:has(.email-item.selected) .email-detail-column {
        display: block;
    }
    
    /* Скрываем список когда письмо открыто */
    .email-view-container:has(.email-item.selected) .email-list-column {
        display: none;
    }

    .email-detail {
        padding: 20px;
        min-height: 100vh;
        max-height: 100vh;
        overflow-y: auto;
    }

    .email-detail-empty {
        min-height: 250px;
        padding: 40px 20px;
    }

    .email-detail-empty-icon {
        font-size: 48px;
    }

    .toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
    }
}

/* Дополнительные стили для плавности */
* {
    -webkit-tap-highlight-color: transparent;
}

button, .btn-icon, .btn-primary, .btn-secondary, .domain-item, .email-item {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input, textarea {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

