:root {
    --primary: #3498db;
    --secondary: #2ecc71;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --danger: #e74c3c;
    --warning: #f39c12;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: var(--dark);
    color: white;
    padding: 20px 0;
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 4px solid var(--primary);
}

h1 {
    margin: 0;
    font-size: 2.5rem;
}

.subtitle {
    font-style: italic;
    opacity: 0.8;
}

.tab-container {
    margin-bottom: 20px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--primary);
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    background-color: #ddd;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
    transition: background-color 0.3s;
}

.tab:hover {
    background-color: #ccc;
}

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

.tab-content {
    display: none;
    padding: 20px;
    background-color: white;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tab-content.active {
    display: block;
}

.input-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.visualization-area {
    margin-top: 20px;
    padding: 20px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 300px;
}

.step {
    margin-bottom: 15px;
    padding: 10px;
    border-left: 3px solid var(--primary);
    background-color: #f9f9f9;
}

.step-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.animation-container {
    height: 200px;
    position: relative;
    margin: 20px 0;
    border: 1px solid #ddd;
    overflow: hidden;
}

.char-box {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    margin: 5px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-weight: bold;
    position: relative;
    transition: all 0.5s ease;
}

.char-box.highlight {
    background-color: var(--primary);
    color: white;
}

.char-box.encrypted {
    background-color: var(--secondary);
    color: white;
}

.char-box.decrypted {
    background-color: var(--primary);
    color: white;
}

.char-tooltip {
    position: absolute;
    bottom: 45px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    opacity: 0;
    animation: fadeInOut 1.5s ease-in-out forwards;
}

.char-tooltip:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

.mode-selection {
    display: flex;
    margin-bottom: 15px;
    gap: 20px;
}

.mode-selection label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.mode-selection input[type="radio"] {
    margin: 0;
}

.matrix-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.matrix-row {
    display: flex;
}

.matrix-cell {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #ddd;
    margin: 2px;
}

.matrix-cell.highlight {
    background-color: var(--primary);
    color: white;
}

.rail-fence-container {
    margin: 20px 0;
    position: relative;
}

.rail {
    position: relative;
    height: 30px;
    margin-bottom: 10px;
    border-bottom: 1px dashed #ccc;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.compare-table th,
.compare-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.compare-table th {
    background-color: var(--primary);
    color: white;
}

.compare-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.security-meter {
    height: 20px;
    background-color: #ddd;
    margin: 10px 0;
    position: relative;
}

.security-level {
    height: 100%;
    background-color: var(--warning);
    transition: width 0.3s;
}

.speed-meter {
    height: 20px;
    background-color: #ddd;
    margin: 10px 0;
}

.speed-level {
    height: 100%;
    background-color: var(--secondary);
    transition: width 0.3s;
}

footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px;
    background-color: var(--dark);
    color: white;
}

/* Responsive design */
@media (max-width: 768px) {
    .tab {
        flex: 1 0 auto;
        margin-bottom: 5px;
    }

    .button-group {
        flex-direction: column;
    }
}

/* AES specific styles */
.aes-round {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.aes-round-title {
    font-weight: bold;
    margin-bottom: 10px;
}

.sbox-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin: 15px 0;
}

.sbox-cell {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
}