* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --primary-hover: #357abd;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e1e8ed;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Общие классы */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-icon {
    padding: 8px 12px;
    font-size: 18px;
    background: transparent;
    border: 1px solid var(--border-color);
}

.btn-icon:hover {
    background: var(--bg-color);
}


/* Экран авторизации */
#login-screen {
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#login-screen.active {
    display: flex;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 32px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.error-message {
    color: var(--danger-color);
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
    min-height: 20px;
}

.info {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

/* Экран почты */
.mail-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.mail-header {
    background: var(--card-bg);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-left h2 {
    font-size: 24px;
}

.user-email {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-right {
    display: flex;
    gap: 10px;
}

.mail-content {
    display: flex;
    flex: 1;
}

.mail-sidebar {
    width: 200px;
    background: var(--card-bg);
    padding: 20px;
    border-right: 1px solid var(--border-color);
}

.mail-stats {
    font-size: 14px;
    color: var(--text-secondary);
}

.mail-stats span {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    display: block;
}

.mail-main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.emails-container {
    display: none;
}

.emails-container.active {
    display: block;
}

.email-item {
    background: var(--card-bg);
    padding: 20px;
    margin-bottom: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.email-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.email-subject {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 4px;
}

.email-from {
    font-size: 14px;
    color: var(--text-secondary);
}

.email-date {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.email-preview {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.no-emails {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: var(--text-secondary);
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 16px;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    margin: 0;
    flex: 1;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.modal-body {
    padding: 30px;
    max-height: calc(90vh - 180px);
    overflow-y: auto;
}

.email-info {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.email-info p {
    margin-bottom: 8px;
    font-size: 14px;
}

.email-body {
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Смена пароля */
.password-change-form {
    max-width: 500px;
    margin: 0 auto;
}

.password-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    display: none;
}

.password-message.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.password-message.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Генератор карт */
.card-gen-auth {
    max-width: 400px;
    margin: 0 auto;
}

.card-gen-form {
    max-width: 500px;
    margin: 0 auto;
}

.card-gen-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.card-gen-form small {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.bin-presets {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.bin-preset-btn {
    padding: 8px 20px;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
}

.bin-preset-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.bin-preset-btn.active {
    background: var(--primary-color);
    color: white;
}

.generated-cards {
    margin-top: 30px;
    max-height: 400px;
    overflow-y: auto;
}

.card-item {
    background: var(--bg-color);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Courier New', monospace;
}

.card-number {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: 2px;
}

.card-details {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.copy-btn {
    padding: 8px 16px;
    font-size: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: var(--primary-hover);
}

.copy-btn.copied {
    background: #27ae60;
}

/* Адаптивность */
@media (max-width: 768px) {
    .mail-sidebar {
        display: none;
    }
    
    .mail-header {
        padding: 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        flex: 1;
        min-width: 0;
    }
    
    .header-left h2 {
        font-size: 18px;
    }
    
    .user-email {
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 200px;
    }
    
    .header-right {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .btn-icon {
        padding: 8px;
        font-size: 16px;
        min-width: 40px;
    }
    
    .btn-secondary {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .card-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .header-left h2 {
        font-size: 16px;
    }
    
    .user-email {
        max-width: 150px;
    }
    
    .btn-icon {
        padding: 6px;
        font-size: 14px;
        min-width: 36px;
    }
} 