/* Modern styling */
:root {
  --primary-color: #2c3e50;
  --secondary-color: #34495e;
  --accent-color: #3498db;
  --success-color: #2ecc71;
  --warning-color: #f1c40f;
  --danger-color: #e74c3c;
  --light-bg: #ecf0f1;
  --dark-text: #2c3e50;
  --light-text: #ffffff;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  background-color: var(--light-bg);
  color: var(--dark-text);
}

/* Header styling */
#header-page {
  background: #1a2a6c;  /* fallback for old browsers */
  background: -webkit-linear-gradient(to right, #fdbb2d, #b21f1f, #1a2a6c);  
  background: linear-gradient(to right, #fdbb2d, #b21f1f, #1a2a6c); 
  padding: 2.5rem 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

#header-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQ4MCIgaGVpZ2h0PSI2NTAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+ICAgIDxwYXRoIGQ9Ik03MzEuMjA3IDY0OS44MDJDOTM1LjQ4NCA2NDkuODAyIDExMDIuMzggNTA1LjM1NyAxMTAyLjM4IDMyOC41MDhjMC0xNzYuODQ4LTE2Ni44OTYtMzIxLjI5My0zNzEuMTczLTMyMS4yOTNTMzYwLjAzNCAxNTEuNjYgMzYwLjAzNCAzMjguNTA4YzAgMTc2Ljg0OCAxNjYuODk2IDMyMS4yOTQgMzcxLjE3MyAzMjEuMjk0eiIgZmlsbD0iI0ZGRiIgZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsLW9wYWNpdHk9Ii4xNSIvPjwvc3ZnPg==');
  background-size: cover;
  opacity: 0.1;
}

#header-page .container {
  position: relative;
  z-index: 1;
}

#header-page .display-4 {
  font-weight: 700;
  font-size: 2.8rem;
  margin-bottom: 0.8rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
  letter-spacing: -0.5px;
}

#header-page .lead {
  font-size: 1.3rem;
  font-weight: 400;
  opacity: 0.95;
  margin-bottom: 1.5rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.header-info {
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 1.1rem;
  opacity: 0.9;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.header-info p {
  margin: 0;
}

.header-info a {
  color: var(--light-text);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
}

.header-info a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.header-info a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Navbar styling */
.navbar {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #2c3e50 100%) !important;
  padding: 0.8rem 0;
  box-shadow: 0 2px 15px rgba(0,0,0,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.navbar-brand {
  font-size: 1.4rem;
  font-weight: 600;
  color: white !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand i {
  font-size: 1.6rem;
  color: var(--accent-color);
  transition: transform 0.3s ease;
}

.navbar-brand:hover i {
  transform: rotate(360deg);
}

.nav-link {
  font-weight: 500;
  padding: 0.7rem 1.2rem !important;
  border-radius: 6px;
  transition: all 0.3s ease;
  color: rgba(255,255,255,0.9) !important;
  position: relative;
  margin: 0 0.2rem;
}

.nav-link i {
  margin-right: 0.5rem;
  font-size: 0.9em;
  transition: transform 0.3s ease;
}

.nav-link:hover {
  color: white !important;
  background-color: rgba(255,255,255,0.1);
  transform: translateY(-2px);
}

.nav-link:hover i {
  transform: scale(1.2);
}

.nav-link.active {
  background: var(--accent-color);
  color: white !important;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.nav-link.active i {
  color: white;
}

/* Content containers */
.container.content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
  padding: 2.5rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* Form elements */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--dark-text);
}

.form-control {
  border: 2px solid #e9ecef;
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

textarea.form-control {
  min-height: 120px;
}

/* Buttons */
.btn {
  font-weight: 600;
  padding: 0.75rem 2rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  border: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

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

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Playfair table */
table.playfair {
  width: 100%;
  max-width: 400px;
  margin: 2rem auto;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--secondary-color);
}

td.playfair {
  width: 50px;
  height: 50px;
  text-align: center;
  font-weight: 600;
  font-size: 1.1rem;
  background-color: white;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

td.playfair:hover {
  background-color: var(--accent-color);
  color: white;
  cursor: pointer;
}

/* Error messages */
.error {
  color: var(--danger-color);
  background-color: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.2);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #header-page {
    padding: 2rem 0;
  }
  
  #header-page .display-4 {
    font-size: 2rem;
  }
  
  #header-page .lead {
    font-size: 1.1rem;
  }
  
  .header-info {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    font-size: 1rem;
  }
  
  .container.content {
    padding: 1.5rem;
  }
  
  td.playfair {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* Caesar visualization */
.caesar-visual {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin: 1rem 0;
}

.shift-example {
  max-width: 400px;
  margin: 0 auto;
}

.shift-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0;
}

.label {
  font-weight: 600;
  width: 80px;
  text-align: right;
}

.alphabet {
  font-family: monospace;
  font-size: 1.2rem;
  letter-spacing: 0.3rem;
  padding: 0.5rem 1rem;
  background: #f8f9fa;
  border-radius: 4px;
  flex-grow: 1;
  text-align: center;
}

.shift-arrow {
  text-align: center;
  font-size: 1.2rem;
  color: var(--primary-color);
  margin: 0.5rem 0;
  font-weight: 500;
}

.alphabet.shifted {
  color: var(--accent-color);
}

.example-text {
  text-align: center;
  font-size: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

/* Vigenere table */
.vigenere-table {
  width: auto;
  margin: 1rem auto;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-family: monospace;
}

.vigenere-table th,
.vigenere-table td {
  border: 1px solid #dee2e6;
  padding: 0.75rem;
  text-align: center;
  min-width: 2.5rem;
  font-size: 1rem;
}

.vigenere-table th {
  background: var(--primary-color);
  color: white;
  font-weight: bold;
}

.vigenere-table th:first-child {
  background: var(--secondary-color);
}

.vigenere-table td:first-child {
  background: var(--primary-color);
  color: white;
  font-weight: bold;
}

.vigenere-table tr:nth-child(even) {
  background: #f8f9fa;
}

/* Bcrypt structure visualization */
.bcrypt-structure {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.structure-item {
    text-align: center;
}

.structure-item .badge {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.structure-item small {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

/* Badge colors */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-info {
    background-color: var(--accent-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
    color: var(--dark-text) !important;
}

/* MD5 Process Visualization */
.md5-process {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.process-step {
  text-align: center;
  padding: 1rem;
  background: var(--light-bg);
  border-radius: 8px;
  min-width: 120px;
  transition: all 0.3s ease;
}

.process-step:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.step-icon {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.step-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--secondary-color);
}

.step-arrow {
  color: var(--accent-color);
  font-size: 1.5rem;
}

@media (max-width: 768px) {
  .md5-process {
    gap: 0.5rem;
  }
  
  .process-step {
    min-width: 100px;
    padding: 0.75rem;
  }
  
  .step-icon {
    font-size: 1.5rem;
  }
  
  .step-label {
    font-size: 0.8rem;
  }
  
  .step-arrow {
    font-size: 1rem;
  }
}

/* Thêm hiệu ứng hover cho các icon */
.step-icon i {
  transition: transform 0.3s ease;
}

.process-step:hover .step-icon i {
  transform: scale(1.2);
}

/* Màu sắc cho từng icon */
.process-step:nth-child(1) .step-icon {
  color: #e74c3c;
}

.process-step:nth-child(3) .step-icon {
  color: #f1c40f;
}

.process-step:nth-child(5) .step-icon {
  color: #2ecc71;
}

.process-step:nth-child(7) .step-icon {
  color: #3498db;
}

/* Header icon styling */
.header-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  color: rgba(255,255,255,0.9);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

#header-page .lead i {
  margin-right: 0.5rem;
  opacity: 0.9;
}

.header-info i {
  margin-right: 0.5rem;
  opacity: 0.8;
  font-size: 0.9em;
}

.header-info a i {
  margin-right: 0.3rem;
  font-size: 0.9em;
}

/* Hover effects */
.header-icon i:hover {
  transform: scale(1.1);
  transition: transform 0.3s ease;
}

.header-info a:hover i {
  color: var(--warning-color);
  transition: color 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header-icon {
    font-size: 3rem;
  }
  
  .header-info {
    text-align: center;
  }
  
  .header-info p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }
}

/* AES Process Visualization */
.aes-process {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.aes-rounds {
  background: var(--light-bg);
  padding: 1.5rem;
  border-radius: 8px;
  margin-top: 2rem;
}

.aes-rounds h5 {
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 1.5rem;
}

.round-steps {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.round-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  min-width: 120px;
  transition: all 0.3s ease;
}

.round-step:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.round-step i {
  font-size: 1.5rem;
  color: var(--accent-color);
}

.round-step span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--secondary-color);
}

/* Màu sắc cho các bước */
.round-step:nth-child(1) i { color: #e74c3c; }
.round-step:nth-child(2) i { color: #f1c40f; }
.round-step:nth-child(3) i { color: #2ecc71; }
.round-step:nth-child(4) i { color: #3498db; }

/* RSA Process Visualization */
.rsa-process {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.rsa-keys {
  background: var(--light-bg);
  padding: 1.5rem;
  border-radius: 8px;
  margin-top: 2rem;
}

.rsa-keys h5 {
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 1.5rem;
}

.key-info {
  display: flex;
  justify-content: center;
  gap: 3rem;
}

.key-item {
  text-align: center;
}

.key-item .badge {
  font-size: 1rem;
  padding: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.key-item p {
  font-family: "Courier New", monospace;
  margin: 0;
  font-size: 1.1rem;
}

/* Màu sắc cho các bước RSA */
.rsa-process .process-step:nth-child(1) .step-icon { color: #e74c3c; }
.rsa-process .process-step:nth-child(3) .step-icon { color: #f1c40f; }
.rsa-process .process-step:nth-child(5) .step-icon { color: #2ecc71; }
.rsa-process .process-step:nth-child(7) .step-icon { color: #3498db; }

/* RSA Example Styling */
.rsa-example {
  padding: 1rem;
  background: var(--light-bg);
  border-radius: 8px;
}

.example-step {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.example-step:last-child {
  margin-bottom: 0;
}

.example-step h5 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-content {
  padding-left: 1.5rem;
  border-left: 3px solid var(--accent-color);
}

.step-content p {
  margin-bottom: 0.5rem;
  font-family: "Courier New", monospace;
}

.note {
  background: #fff3cd;
  border-left: 4px solid var(--warning-color);
  padding: 0.75rem;
  margin-top: 1rem;
  border-radius: 0 4px 4px 0;
  font-size: 0.9rem;
}

.note i {
  color: var(--warning-color);
  margin-right: 0.5rem;
}

.key-pair {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.key-box {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 6px;
  text-align: center;
  min-width: 200px;
}

.key-box.public {
  border-left: 4px solid var(--success-color);
}

.key-box.private {
  border-left: 4px solid var(--danger-color);
}

.key-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
}

.encryption-example {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 6px;
  margin-top: 1rem;
}

.calculation {
  font-family: "Courier New", monospace;
  padding: 0.5rem;
  background: white;
  border-radius: 4px;
  margin: 0.5rem 0 1rem 1rem;
  color: var(--primary-color);
}

@media (max-width: 768px) {
  .step-content {
    padding-left: 1rem;
  }
  
  .key-pair {
    gap: 1rem;
  }
  
  .key-box {
    min-width: 100%;
  }
}

/* Navbar mobile styling */
@media (max-width: 991.98px) {
  .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(44, 62, 80, 0.98);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 0 0 12px 12px;
    margin-top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-top: none;
  }

  .navbar-collapse.collapsing {
    transition: all 0.35s ease;
  }

  .navbar-collapse.show {
    transition: all 0.35s ease;
  }

  .navbar {
    position: relative;
  }

  .navbar-nav {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .nav-item {
    width: 100%;
  }

  .nav-link {
    padding: 0.8rem 1.2rem !important;
    border-radius: 8px;
    display: flex;
    align-items: center;
  }

  .nav-link i {
    width: 24px;
    text-align: center;
    margin-right: 0.8rem;
  }

  .navbar-toggler {
    border: none;
    padding: 0.5rem;
    color: white;
    transition: all 0.3s ease;
  }

  .navbar-toggler:hover {
    transform: scale(1.1);
  }

  .navbar-toggler:focus {
    box-shadow: none;
    outline: none;
  }

  .navbar-toggler-icon {
    width: 1.5em;
    height: 1.5em;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  }

  /* Animation for menu items */
  .nav-item {
    opacity: 0;
    transform: translateY(-10px);
    animation: slideIn 0.3s ease forwards;
  }

  @keyframes slideIn {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-item:nth-child(1) { animation-delay: 0.1s; }
  .nav-item:nth-child(2) { animation-delay: 0.15s; }
  .nav-item:nth-child(3) { animation-delay: 0.2s; }
  .nav-item:nth-child(4) { animation-delay: 0.25s; }
  .nav-item:nth-child(5) { animation-delay: 0.3s; }
  .nav-item:nth-child(6) { animation-delay: 0.35s; }
  .nav-item:nth-child(7) { animation-delay: 0.4s; }
}

/* Thêm hiệu ứng ripple cho nav-link */
.nav-link {
  overflow: hidden;
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,.7) 0%, rgba(255,255,255,.3) 40%, transparent 70%);
  top: 0;
  left: 0;
  opacity: 0;
  transform: scale(4);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.nav-link:active::after {
  opacity: 1;
  transform: scale(0);
  transition: transform 0s;
}
