/* ==========================================================================
   CSS DESIGN SYSTEM: CYBER VAULT SV-2000
   ========================================================================== */

:root {
  --bg-primary: #0a0c10;
  --bg-secondary: #131722;
  --bg-tertiary: #1b2030;
  --panel-bg: rgba(19, 23, 34, 0.75);
  
  --color-gold: #ffd700;
  --color-gold-hover: #ffea70;
  --color-gold-glow: rgba(255, 215, 0, 0.3);
  
  --color-cyber-cyan: #00f0ff;
  --color-cyan-glow: rgba(0, 240, 255, 0.45);
  
  --color-neon-green: #39ff14;
  --color-green-glow: rgba(57, 255, 20, 0.5);
  
  --color-neon-red: #ff3131;
  --color-red-glow: rgba(255, 49, 49, 0.6);
  
  --text-main: #f0f4f8;
  --text-muted: #8ba2b5;
  --text-dark: #07090e;

  --safe-metal-grad: linear-gradient(135deg, #2c302e 0%, #1c1e1d 50%, #0d0e0e 100%);
  --safe-beveled-border: inset 2px 2px 2px rgba(255,255,255,0.1), inset -2px -2px 2px rgba(0,0,0,0.5);
  
  --font-display: 'Orbitron', 'Montserrat', sans-serif;
  --font-lcd: 'Share Tech Mono', monospace;
  --font-sans: 'Montserrat', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Ambient Background Glows */
.ambient-glow {
  position: fixed;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  filter: blur(150px);
  z-index: -1;
  opacity: 0.12;
  pointer-events: none;
}

.glow-1 {
  background-color: var(--color-cyber-cyan);
  top: -10%;
  left: -10%;
}

.glow-2 {
  background-color: var(--color-gold);
  bottom: -10%;
  right: -10%;
}

/* App Container Layout */
.app-container {
  width: 100%;
  max-width: 1200px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 1.5rem;
}

.app-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #ffffff 0%, var(--color-cyber-cyan) 50%, var(--color-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  gap: 10px;
}

.logo-icon {
  stroke: var(--color-cyber-cyan);
  filter: drop-shadow(0 0 8px var(--color-cyan-glow));
}

.badge {
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  letter-spacing: 1px;
  vertical-align: middle;
  margin-left: 10px;
  text-shadow: 0 0 5px var(--color-gold-glow);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.5rem;
  letter-spacing: 0.5px;
}

/* Vault Wrapper & Container (3D perspective setup) */
.vault-wrapper {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 2500px; /* Crucial for 3D vault door swing */
  margin: 1.5rem 0;
}

.safe-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 600px;
  background: var(--safe-metal-grad);
  border-radius: 12px;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.75),
    0 0 30px rgba(0, 240, 255, 0.05),
    inset 0 0 20px rgba(255, 255, 255, 0.05);
  border: 10px solid #222524;
  outline: 2px solid #333;
  transform-style: preserve-3d;
}

/* ==========================================================================
   SAFE INTERIOR (BEHIND DOOR)
   ========================================================================== */
.safe-interior {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #1b2030 0%, #0d0f15 100%);
  border-radius: 4px;
  padding: 25px;
  z-index: 1;
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(0, 240, 255, 0.2); /* Cyber glow inside */
}

/* Futuristic interior details */
.safe-interior::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.interior-grid {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  z-index: 2;
}

.interior-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(0, 240, 255, 0.2);
  padding-bottom: 12px;
  margin-bottom: 15px;
}

.interior-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 1px;
  color: var(--color-cyber-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cabinet-status {
  font-family: var(--font-lcd);
  font-size: 0.8rem;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pulse-indicator-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-neon-green);
  box-shadow: 0 0 8px var(--color-green-glow);
  animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

/* File cabinet tabs */
.cabinet-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.tab-btn:hover {
  background: rgba(0, 240, 255, 0.1);
  color: var(--text-main);
  border-color: rgba(0, 240, 255, 0.3);
}

.tab-btn.active {
  background: var(--color-cyber-cyan);
  color: var(--text-dark);
  border-color: var(--color-cyber-cyan);
  font-weight: 600;
  box-shadow: 0 0 10px var(--color-cyan-glow);
}

/* Cabinet File Listing */
.file-list-scroll {
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 5px;
  margin-bottom: 15px;
}

/* Custom Scrollbar for safe files */
.file-list-scroll::-webkit-scrollbar {
  width: 6px;
}
.file-list-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
}
.file-list-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.2);
  border-radius: 3px;
}
.file-list-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--color-cyber-cyan);
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.file-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.file-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background-color: var(--color-gold);
}

.file-card.category-image::before { background-color: var(--color-cyber-cyan); }
.file-card.category-document::before { background-color: var(--color-gold); }
.file-card.category-secret::before { background-color: var(--color-neon-red); }

.file-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.file-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.file-icon {
  margin-top: 2px;
  color: var(--text-muted);
}
.file-card.category-image .file-icon { color: var(--color-cyber-cyan); }
.file-card.category-document .file-icon { color: var(--color-gold); }
.file-card.category-secret .file-icon { color: var(--color-neon-red); }

.file-meta {
  display: flex;
  flex-direction: column;
}

.file-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
  margin-bottom: 2px;
}

.file-size {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-lcd);
}

.file-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  padding: 5px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: var(--color-cyber-cyan);
  color: var(--text-dark);
  border-color: var(--color-cyber-cyan);
}

.btn-icon.btn-delete:hover {
  background: var(--color-neon-red);
  color: var(--text-main);
  border-color: var(--color-neon-red);
}

.interior-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid rgba(0, 240, 255, 0.1);
  padding-top: 15px;
}

.action-left {
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   THE SAFE DOOR (MECHANICAL AND INTERACTIVE)
   ========================================================================== */
.safe-door {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  transform-style: preserve-3d;
  transform-origin: left center; /* Swing left */
  transition: transform 1.8s cubic-bezier(0.34, 1.2, 0.64, 1);
  box-shadow: 
    -10px 0 20px rgba(0,0,0,0.5),
    10px 0 25px rgba(0,0,0,0.8);
}

/* Opened Door State */
.safe-container.door-open .safe-door {
  transform: rotateY(-115deg) translateZ(1px);
}

/* Double-sided door construct */
.door-front, .door-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 4px;
}

.door-front {
  background: var(--safe-metal-grad);
  border: 12px solid #202422;
  box-shadow: var(--safe-beveled-border);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}

/* Door Backside design (Wiring and internal locks) */
.door-back {
  background: linear-gradient(135deg, #181b1a 0%, #0d0f0e 100%);
  border: 12px solid #1a1c1c;
  transform: rotateY(180deg);
  padding: 30px;
  z-index: 1;
}

.door-back-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
  background-size: 30px 30px;
}

.wiring-box {
  border: 2px solid rgba(255, 215, 0, 0.2);
  border-radius: 6px;
  padding: 15px;
  height: 100%;
  position: relative;
  background: rgba(0,0,0,0.4);
}

.wiring-label {
  position: absolute;
  top: -10px;
  left: 15px;
  background: #111;
  padding: 0 8px;
  font-family: var(--font-lcd);
  font-size: 0.75rem;
  color: var(--color-gold);
}

.circuits {
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(rgba(255, 215, 0, 0.15) 15%, transparent 16%),
    radial-gradient(rgba(0, 240, 255, 0.1) 15%, transparent 16%);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
}

/* Mechanical Hinge visual components */
.hinge {
  position: absolute;
  left: -20px;
  width: 14px;
  height: 50px;
  background: linear-gradient(to right, #111, #444, #222);
  border-radius: 3px;
  border: 1px solid #111;
}
.hinge-top { top: 70px; }
.hinge-bottom { bottom: 70px; }

/* Mechanical Locking Bolts (slide back when unlocked) */
.bolt {
  position: absolute;
  right: -18px;
  width: 20px;
  height: 45px;
  background: linear-gradient(to bottom, #777, #ccc, #555);
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
  border: 1px solid #333;
  box-shadow: 5px 3px 5px rgba(0,0,0,0.5);
  transition: transform 0.6s cubic-bezier(0.77, 0, 0.175, 1);
  transform-origin: left center;
}

.bolt-top { top: 100px; }
.bolt-middle { top: 270px; }
.bolt-bottom { top: 440px; }

/* Bolt retract action when unlocked */
.safe-container.bolts-retracted .bolt {
  transform: scaleX(0.1) translateX(-10px);
}

/* ==========================================================================
   SAFE DOOR INTERFACE (LCD, KEYPAD, ROTARY DIAL)
   ========================================================================== */
.interface-plate {
  width: 320px;
  padding: 25px;
  background: linear-gradient(135deg, #171918 0%, #252927 100%);
  border-radius: 8px;
  border: 4px solid #111;
  box-shadow: 
    inset 0 0 10px rgba(0,0,0,0.8),
    0 10px 20px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* LCD Screen design */
.lcd-display {
  width: 100%;
  height: 80px;
  background-color: #030a08;
  border-radius: 4px;
  border: 2px solid #0d1211;
  position: relative;
  overflow: hidden;
  padding: 10px;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.9);
}

.lcd-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(0, 240, 255, 0.1) 0%, transparent 80%);
  pointer-events: none;
}

/* LCD Pixel Scanlines Effect */
.lcd-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 3px, 6px 100%;
  pointer-events: none;
  z-index: 5;
}

.lcd-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  font-family: var(--font-lcd);
  position: relative;
  z-index: 2;
}

.lcd-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: rgba(0, 240, 255, 0.5);
  letter-spacing: 1px;
}

.lcd-main {
  font-size: 1.4rem;
  color: var(--color-cyber-cyan);
  font-weight: bold;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 0 8px var(--color-cyan-glow);
}

.lcd-main.denied {
  color: var(--color-neon-red);
  text-shadow: 0 0 8px var(--color-red-glow);
}

.lcd-main.granted {
  color: var(--color-neon-green);
  text-shadow: 0 0 8px var(--color-green-glow);
}

.lcd-dots {
  font-size: 0.9rem;
  color: rgba(0, 240, 255, 0.7);
  letter-spacing: 6px;
  text-align: center;
  min-height: 1.2rem;
}

/* LEDs Status */
.led-bar {
  display: flex;
  justify-content: space-around;
  width: 100%;
  background: rgba(0,0,0,0.3);
  padding: 6px 0;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.03);
}

.led-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #222;
  border: 1px solid #111;
  transition: all 0.2s ease;
}

.led-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.led-red.active {
  background-color: var(--color-neon-red);
  box-shadow: 0 0 10px var(--color-neon-red), inset 0 0 3px #fff;
}

.led-green.active {
  background-color: var(--color-neon-green);
  box-shadow: 0 0 10px var(--color-neon-green), inset 0 0 3px #fff;
}

/* Rotary Dial (Interactive Mechanical Wheel) */
.rotary-dial-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 5px 0;
}

.rotary-dial-outer {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at center, #1b1d1c 0%, #0c0d0d 100%);
  border: 6px solid #111;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.8);
}

/* Engraved dial degree marks */
.dial-ticks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle, transparent 55%, #111 56%, #111 58%, transparent 59%);
  pointer-events: none;
}

.rotary-dial-inner {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe76c 0%, #c49900 60%, #876900 100%);
  border: 3px solid #111;
  box-shadow: 
    inset 0 4px 10px rgba(255,255,255,0.4),
    inset 0 -4px 10px rgba(0,0,0,0.6),
    0 4px 8px rgba(0,0,0,0.6);
  cursor: grab;
  transition: transform 1.2s cubic-bezier(0.19, 1, 0.22, 1);
  transform: rotate(0deg);
}

.rotary-dial-inner:active {
  cursor: grabbing;
}

.dial-center-cap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, #444, #111);
  border: 2px solid #111;
  z-index: 10;
}

.dial-indicator {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 12px;
  background-color: #111;
  border-radius: 2px;
  z-index: 5;
}

/* Mechanical Spokes */
.dial-spoke {
  position: absolute;
  background: linear-gradient(to right, #666, #fff, #555);
  width: 6px;
  height: 35px;
  left: calc(50% - 3px);
  transform-origin: center bottom;
  border-radius: 3px;
  border: 1px solid #111;
}

.spoke-1 { transform: rotate(0deg) translateY(-25px); }
.spoke-2 { transform: rotate(120deg) translateY(-25px); }
.spoke-3 { transform: rotate(240deg) translateY(-25px); }

/* Keypad Grid layout */
.numeric-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.key-btn {
  background: linear-gradient(to bottom, #2b302c, #1f2220);
  border: 2px solid #111;
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 10px 0;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 3px 5px rgba(0,0,0,0.6);
  text-shadow: 0 2px 2px rgba(0,0,0,0.8);
  transition: all 0.08s ease;
  user-select: none;
  outline: none;
}

.key-btn:hover {
  background: linear-gradient(to bottom, #3a413c, #2b302c);
  color: var(--color-cyber-cyan);
  border-color: rgba(0, 240, 255, 0.3);
  box-shadow: 
    0 0 8px rgba(0, 240, 255, 0.2),
    0 3px 5px rgba(0,0,0,0.6);
}

.key-btn:active {
  transform: translateY(2px);
  background: #111;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.9);
  color: var(--color-cyber-cyan);
  text-shadow: 0 0 5px var(--color-cyan-glow);
}

.key-action {
  font-size: 1rem;
}

.key-clear {
  color: var(--color-neon-red);
}
.key-clear:hover {
  color: #ff5555;
  border-color: rgba(255, 49, 49, 0.3);
}

.key-enter {
  color: var(--color-neon-green);
}
.key-enter:hover {
  color: #6eff50;
  border-color: rgba(57, 255, 20, 0.3);
}

/* Warning Shake animation for wrong inputs */
.shake {
  animation: lcd-shake 0.35s ease-in-out;
}

@keyframes lcd-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* ==========================================================================
   BUTTONS AND GENERAL CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  user-select: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-cyber-cyan);
  color: var(--text-dark);
  box-shadow: 0 4px 14px var(--color-cyan-glow);
}
.btn-primary:hover {
  background: #4ef5ff;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--color-cyan-glow);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(255, 49, 49, 0.15);
  border-color: var(--color-neon-red);
  color: #ff6b6b;
}
.btn-danger:hover {
  background: var(--color-neon-red);
  color: var(--text-main);
  box-shadow: 0 4px 14px var(--color-red-glow);
  transform: translateY(-1px);
}

/* ==========================================================================
   MODAL WINDOWS & GLASSMORPHISM
   ========================================================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 5, 8, 0.85);
  backdrop-filter: blur(8px);
}

.modal-wrapper {
  position: relative;
  z-index: 102;
  width: 90%;
  max-width: 550px;
  background: rgba(20, 24, 37, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 12px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.6),
    0 0 25px rgba(0, 240, 255, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.open .modal-wrapper {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--color-cyber-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-btn:hover {
  color: var(--color-neon-red);
}

.modal-body {
  padding: 22px;
  max-height: 60vh;
  overflow-y: auto;
}

/* Custom Scrollbar for Modal Body */
.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.1);
  border-radius: 3px;
}

.modal-footer {
  padding: 15px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
}

/* Forms layout inside modals */
.form-group {
  margin-bottom: 18px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: all 0.2s ease;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--color-cyber-cyan);
  background: rgba(0, 240, 255, 0.02);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.15);
}

.form-select option {
  background-color: var(--bg-secondary);
  color: var(--text-main);
}

.form-textarea {
  resize: vertical;
}

.error-msg {
  color: var(--color-neon-red);
  font-size: 0.8rem;
  margin-top: 8px;
  display: none;
}

/* Tabs inside Add File Modal */
.tab-group {
  margin-bottom: 15px;
}

.input-tabs {
  display: flex;
  background: rgba(0,0,0,0.2);
  padding: 4px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.05);
}

.input-tab {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.input-tab.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-weight: 600;
}

.input-content {
  display: none;
}

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

/* File Upload Drag-and-Drop Area */
.file-drop-area {
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-drop-area:hover {
  border-color: var(--color-cyber-cyan);
  background: rgba(0, 240, 255, 0.01);
}

.upload-icon {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.file-message {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Thumbnail preview for upload */
.upload-preview-container {
  margin-top: 15px;
  display: flex;
  justify-content: center;
}

.upload-preview {
  max-width: 100%;
  max-height: 150px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Secret File Previews in Modal */
.preview-text {
  background: #080a0f;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 6px;
  padding: 15px;
  font-family: var(--font-lcd);
  font-size: 0.9rem;
  line-height: 1.5;
  color: #a4c0d4;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-image-container {
  display: flex;
  justify-content: center;
  background: #080a0f;
  border-radius: 6px;
  padding: 10px;
}

.preview-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 4px;
}

/* Footer & Status */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 2rem;
  line-height: 1.6;
}

.status-tips {
  margin-top: 4px;
}

.highlight {
  color: var(--color-gold);
  font-weight: bold;
}

/* Responsive Scaling */
@media (max-width: 650px) {
  .app-container {
    padding: 1rem 0.5rem;
  }
  
  .logo {
    font-size: 1.8rem;
  }
  
  .safe-container {
    height: 520px;
    border-width: 6px;
    transition: transform 1.8s cubic-bezier(0.34, 1.2, 0.64, 1);
  }

  /* Shift and scale down on mobile when open so the door fits the viewport */
  .safe-container.door-open {
    transform: scale(0.92) translateX(4%);
  }

  .safe-container.door-open .safe-door {
    transform: rotateY(-90deg) translateZ(1px);
  }
  
  .interface-plate {
    width: 270px;
    padding: 15px;
    gap: 12px;
  }
  
  .lcd-display {
    height: 70px;
  }
  
  .lcd-main {
    font-size: 1.2rem;
  }
  
  .rotary-dial-outer {
    width: 90px;
    height: 90px;
  }
  
  .rotary-dial-inner {
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
  }
  
  .spoke-1, .spoke-2, .spoke-3 {
    height: 28px;
  }
  
  .key-btn {
    padding: 8px 0;
    font-size: 1rem;
  }
  
  .file-grid {
    grid-template-columns: 1fr;
  }
  
  .safe-interior {
    padding: 15px;
  }
  
  .interior-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .action-left {
    width: 100%;
    justify-content: space-between;
  }
  
  .interior-actions .btn-danger {
    width: 100%;
  }
}
