:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
}

.card {
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #0d6efd 100%);
    padding: 1.5rem;
}

.card-header h1 {
    margin: 0;
    font-size: 1.8rem;
}

/* Tabs */
.nav-tabs {
    border-bottom: 2px solid #dee2e6;
}

.nav-link {
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
}

.nav-link:hover {
    border-bottom-color: #0d6efd;
}

.nav-link.active {
    background-color: #0d6efd !important;
}

/* Result box */
.result-box {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    line-height: 1.6;
    min-height: 100px;
}

.result-box pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Table styling */
.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
    font-size: 0.9rem;
}

.table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Form controls */
.form-control {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.form-check-label {
    cursor: pointer;
}

/* Loading spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-header h1 {
        font-size: 1.5rem;
    }

    .btn-lg {
        width: 100%;
        margin-bottom: 10px;
    }

    .d-md-flex {
        flex-direction: column;
    }

    .table-responsive {
        font-size: 0.85rem;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .card-header h1 {
        font-size: 1.3rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .form-text {
        font-size: 0.8rem;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#encryptResultContainer,
#decryptResultContainer,
#bruteforceResultsContainer {
    animation: fadeIn 0.5s ease-out;
}

/* Custom scrollbar */
.table-responsive::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Alert styling */
.alert {
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-warning {
    border-left-color: #ffc107;
}

.alert-info {
    border-left-color: #0dcaf0;
}

.alert-success {
    border-left-color: #198754;
}

/* Code block */
code {
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.bg-dark code {
    background-color: transparent;
    color: #fff;
}

/* Исправление белого текста при наведении */
.table tbody tr:hover {
    background-color: #e7f1ff !important;
    color: #212529 !important;
}

.table tbody tr:active {
    background-color: #d4e8ff !important;
    color: #212529 !important;
}

/* Специальные стили для таблицы шифра */
.caesar-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.caesar-table tbody tr:hover td {
    color: #212529 !important;
}

.caesar-table tbody tr.copied-row {
    background-color: #d1e7dd !important;
    animation: highlightRow 1s ease;
}

@keyframes highlightRow {
    0% { background-color: #d1e7dd; }
    50% { background-color: #e7f1ff; }
    100% { background-color: transparent; }
}

/* Улучшенные кнопки в таблице */
.copy-bruteforce {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.caesar-table tbody tr:hover .copy-bruteforce {
    opacity: 1;
}

/* Улучшенный результат */
.result-box {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    line-height: 1.6;
    min-height: 100px;
    color: #212529; /* Четкий черный текст */
}

.result-box pre {
    margin: 0;
    color: #212529; /* Четкий черный текст */
    white-space: pre-wrap;
    word-break: break-word;
}

/* Адаптивность для таблицы */
@media (max-width: 768px) {
    .caesar-table th,
    .caesar-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .copy-bruteforce {
        opacity: 1 !important;
        padding: 0.2rem 0.4rem !important;
        font-size: 0.75rem !important;
    }
}