:root {
  --primary: #2c3e50;
  --secondary: #27ae60;
  --accent: #e74c3c;
  --bg: #ecf0f1;
  --card-bg: #fff;
  --text: #2c3e50;
  --radius: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  line-height: 1.6;
}

header, main, footer {
  width: 100%;
  max-width: 800px;
}

header {
  background: var(--primary);
  color: #fff;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius) var(--radius) 0 0;
}

header h1 { 
  font-size: 1.6rem; 
}

.theme-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

main {
  background: var(--card-bg);
  padding: 20px;
  border: 2px solid #ddd;
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  position: relative;
}

.area { 
  margin-bottom: 20px; 
}

.area label {
  font-weight: 600;
  margin-bottom: 5px;
  display: block;
  color: var(--primary);
}

/* Inline Info Tooltip */
.info-container {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.info-tooltip {
  position: absolute;
  top: 50%;
  left: 110%;
  transform: translateY(-50%);
  background: #333;
  color: #fff;
  font-size: 0.75rem;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.info-tooltip.show { 
  opacity: 1; 
}

textarea, input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #bdc3c7;
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: #f9f9f9;
  transition: border-color 0.3s;
}

textarea:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.counter {
  text-align: right;
  font-size: 0.8rem;
  color: #7f8c8d;
  margin-top: 5px;
}

/* Secret Key Toggle & Field */
.secret-key-toggle { 
  margin: 10px 0; 
}

.secret-key-field { 
  margin-bottom: 20px; 
  display: none; 
}

/* Process Buttons */
.process-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 20px;
}

.process-buttons button {
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.process-buttons button:hover { 
  transform: translateY(-2px); 
}

.btn-encrypt { 
  background: var(--primary); 
}

.btn-decrypt { 
  background: var(--secondary); 
}

/* Output Area */
.output-container {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.button-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.button-panel button {
  padding: 10px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.button-panel button:hover { 
  transform: translateY(-2px); 
}

.btn-copy { 
  background: #34495e; 
}

.btn-clear { 
  background: var(--accent); 
}

footer {
  text-align: center;
  font-size: 0.85rem;
  color: #7f8c8d;
  margin-top: 20px;
}

/* Dark mode */
body.dark-mode { 
  background: #1e272e; 
}

body.dark-mode header { 
  background: #40739e; 
}

body.dark-mode main {
  background: #2f3640;
  color: #f5f6fa;
  border-color: #444;
}

body.dark-mode textarea,
body.dark-mode input[type="text"] {
  background: #353b48;
  border-color: #718093;
  color: #f5f6fa;
}

body.dark-mode .counter { 
  color: #dcdde1; 
}

body.dark-mode .btn-copy { 
  background: #2c3e50; 
}

body.dark-mode .area label {
  color: #dcdde1;
}

/* Notification style */
.notification {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--secondary);
  color: white;
  padding: 12px 25px;
  border-radius: var(--radius);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: bottom 0.3s ease;
  z-index: 1000;
}

.notification.show {
  bottom: 20px;
}