@charset "UTF-8";

/* ==== Table of contents ===*/
/* - Variables               */
/* - Base styles             */
/* - Typography              */
/* - Grid                    */
/* - Cards                   */
/* - Buttons                 */
/* - Forms & Inputs          */
/* - Alerts                  */
/* - Navigation              */
/* - Layout                  */
/* - Header                  */
/* - Footer                  */
/* - Modals                  */
/* - Toasts                  */
/* - Connection Status       */
/* ==========================*/

/* --- Variables --- */
:root {
  --color-blue: #2980b9;
  --color-border: #bdc3c7;
  --color-dark: #2c3e50;
  --color-gray: #ecf0f1;
  --color-green: #2e7d32;
  --color-light-gray: #f4f7f6;
  --color-orange: #f39c12;
  --color-red: #c0392b;
  --color-text: #34495e;
  --color-theme: var(--color-green);
  --color-white: #ffffff;
  --phi: 1.618;
  --radius: 6px;
  --shadow-md: 0 5px 15px rgba(0,0,0,0.1);
  --shadow-sm: 0 2px 5px rgba(0,0,0,0.05);
  --transition: 0.2s ease;
}

/* --- Base styles --- */
*, *:before, *:after { box-sizing: border-box; }
html { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; font-size: 16px; }
body {
  background: var(--color-light-gray);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  line-height: var(--phi);
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--color-blue);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

a:hover { color: var(--color-theme); }

img {
  display: block;
  max-width: 100%;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-dark);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 1rem;
}

h1 { font-size: 2.5rem;  }
h2 { font-size: 2rem;    }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem;  }

p { margin: 0 0 1rem; }

.text-center  { text-align: center;         }
.text-danger  { color: var(--color-red);    }
.text-left    { text-align: left;           }
.text-muted   { color: #7f8c8d;             }
.text-primary { color: var(--color-blue);   }
.text-right   { text-align: right;          }
.text-success { color: var(--color-green);  }
.text-warning { color: var(--color-orange); }

/* --- Grid --- */
.wrapper {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  min-width: 0;
  overflow: hidden;
  padding: 0;
}

.container {
  margin: 0 auto;
  max-width: 1400px;
  padding: 0 15px;
  width: 100%;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -15px;
}

.row-around  { justify-content: space-around; }

.row-between { justify-content: space-between; }

.row-center  { justify-content: center; }

.col, [class*="col-"] {
  display: flex;
  flex-direction: column;
  padding: 0 15px;
  position: relative;
  width: 100%;
}

.col > .card {
  flex: 1 1 auto;
  width: 100%;
}

.col-1  { flex: 0 0 8.33%;  max-width: 8.33%;  }
.col-2  { flex: 0 0 16.66%; max-width: 16.66%; }
.col-3  { flex: 0 0 25%;    max-width: 25%;    }
.col-4  { flex: 0 0 33.33%; max-width: 33.33%; }
.col-5  { flex: 0 0 41.66%; max-width: 41.66%; }
.col-6  { flex: 0 0 50%;    max-width: 50%;    }
.col-7  { flex: 0 0 58.33%; max-width: 58.33%; }
.col-8  { flex: 0 0 66.66%; max-width: 66.66%; }
.col-9  { flex: 0 0 75%;    max-width: 75%;    }
.col-10 { flex: 0 0 83.33%; max-width: 83.33%; }
.col-11 { flex: 0 0 91.66%; max-width: 91.66%; }
.col-12 { flex: 0 0 100%;   max-width: 100%;   }

@media (min-width: 768px) {
  .col-md-1  { flex: 0 0 8.33%;  max-width: 8.33%;  }
  .col-md-2  { flex: 0 0 16.66%; max-width: 16.66%; }
  .col-md-3  { flex: 0 0 25%;    max-width: 25%;    }
  .col-md-4  { flex: 0 0 33.33%; max-width: 33.33%; }
  .col-md-5  { flex: 0 0 41.66%; max-width: 41.66%; }
  .col-md-6  { flex: 0 0 50%;    max-width: 50%;    }
  .col-md-7  { flex: 0 0 58.33%; max-width: 58.33%; }
  .col-md-8  { flex: 0 0 66.66%; max-width: 66.66%; }
  .col-md-9  { flex: 0 0 75%;    max-width: 75%;    }
  .col-md-10 { flex: 0 0 83.33%; max-width: 83.33%; }
  .col-md-11 { flex: 0 0 91.66%; max-width: 91.66%; }
  .col-md-12 { flex: 0 0 100%;   max-width: 100%;   }
}

@media (min-width: 1024px) {
  .col-lg-1  { flex: 0 0 8.33%;  max-width: 8.33%;  }
  .col-lg-2  { flex: 0 0 16.66%; max-width: 16.66%; }
  .col-lg-3  { flex: 0 0 25%;    max-width: 25%;    }
  .col-lg-4  { flex: 0 0 33.33%; max-width: 33.33%; }
  .col-lg-5  { flex: 0 0 41.66%; max-width: 41.66%; }
  .col-lg-6  { flex: 0 0 50%;    max-width: 50%;    }
  .col-lg-7  { flex: 0 0 58.33%; max-width: 58.33%; }
  .col-lg-8  { flex: 0 0 66.66%; max-width: 66.66%; }
  .col-lg-9  { flex: 0 0 75%;    max-width: 75%;    }
  .col-lg-10 { flex: 0 0 83.33%; max-width: 83.33%; }
  .col-lg-11 { flex: 0 0 91.66%; max-width: 91.66%; }
  .col-lg-12 { flex: 0 0 100%;   max-width: 100%;   }
}

/* --- Cards --- */
.card {
  background: var(--color-white);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-header {
  align-items: center;
  background: var(--color-white);
  border-bottom: 1px solid #eee;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  font-weight: 600;
  justify-content: space-between;
  padding: 15px 20px;
}

.card-body { padding: 20px; }

.card-footer {
  border-top: 1px solid #eee;
  padding: 15px 20px;
}

/* --- Buttons --- */
.btn {
  border: 1px solid transparent;
  border-radius: 50px;
  cursor: pointer;
  display: inline-block;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.6rem 1.4rem;
  text-align: center;
  transition: var(--transition);
  user-select: none;
}

.btn:active        { transform: translateY(1px); }
.btn:focus         { outline: none; }
.btn-primary       { background: var(--color-blue); color: var(--color-white); }
.btn-primary:hover { background: #20638f; }
.btn-success       { background: var(--color-green); color: var(--color-white); }
.btn-success:hover { background: #1b4b1e; }
.btn-warning       { background: var(--color-orange); color: var(--color-white); }
.btn-warning:hover { background: #d35400; }
.btn-danger        { background: var(--color-red); color: var(--color-white); }
.btn-danger:hover  { background: #96281b; }
.btn-outline       { background: transparent; border-color: var(--color-blue); color: var(--color-blue); }
.btn-outline:hover { background: var(--color-blue); color: var(--color-white); }
.btn-block         { display: block; width: 100%; }
.btn-lg            { font-size: 1.1rem; padding: 0.8rem 1.8rem; }
.btn-sm            { font-size: 0.85rem; padding: 0.3rem 0.8rem; }

/* --- Forms & Inputs --- */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem; }

.form-control {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: block;
  font-size: 1rem;
  padding: 0.6rem 1rem;
  transition: var(--transition);
  width: 100%;
}

.form-control:focus {
  border-color: var(--color-blue);
  outline: none;
}

.form-control:disabled {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

/* --- Toggle Switch --- */
.toggle { align-items: center; cursor: pointer; display: inline-flex; }

.toggle input { display: none; }

.toggle-track {
  background: var(--color-border);
  border-radius: 20px;
  height: 24px;
  margin-right: 10px;
  position: relative;
  transition: var(--transition);
  width: 44px;
}

.toggle-track:after {
  background: var(--color-white);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  content: '';
  height: 20px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: var(--transition);
  width: 20px;
}

.toggle input:checked + .toggle-track { background: var(--color-theme); }

.toggle input:checked + .toggle-track:after { transform: translateX(20px); }

/* --- Range Slider --- */
input[type=range] {
  -webkit-appearance: none;
  background: transparent;
  margin: 10px 0;
  padding: 0;
  width: 100%;
}

input[type=range]:focus { outline: none; }

input[type=range]::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--color-theme) var(--range-percent, 50%), var(--color-border) var(--range-percent, 50%));
  border-radius: 3px;
  cursor: pointer;
  height: 6px;
  width: 100%;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  background: var(--color-white);
  border: 2px solid var(--color-theme);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  cursor: pointer;
  height: 20px;
  margin-top: -7px;
  width: 20px;
}

input[type=range]::-moz-range-thumb {
  background: var(--color-white);
  border: 2px solid var(--color-theme);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  cursor: pointer;
  height: 20px;
  width: 20px;
}

input[type=range]::-moz-range-track {
  background: linear-gradient(to right, var(--color-theme) var(--range-percent, 50%), var(--color-border) var(--range-percent, 50%));
  border-radius: 3px;
  height: 6px;
}

/* --- Alerts --- */
.alert {
  background: var(--color-white);
  border-left: 5px solid;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  padding: 15px;
}

.alert-danger {
  background: #fdedec;
  border-color: var(--color-red);
  color: var(--color-red);
}

.alert-info {
  background: #ebf5fb;
  border-color: var(--color-blue);
  color: var(--color-blue);
}

.alert-success {
  background: #e9f7ef;
  border-color: var(--color-green);
  color: var(--color-green);
}

.alert-warning {
  background: #fef5e7;
  border-color: var(--color-orange);
  color: #d35400;
}

/* --- Navigation --- */
.header {
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
  height: 60px;
  position: relative;
  z-index: 100;
}

.header .container {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: space-between;
}

.header__left {
  align-items: center;
  display: flex;
  gap: 10px;
}

.nav__list {
  align-items: center;
  display: flex;
}

.nav__item { position: relative; }

.nav__link {
  color: var(--color-text);
  display: block;
  font-weight: 500;
  line-height: 60px;
  padding: 0 18px;
  transition: var(--transition);
}

.nav__link:hover { color: var(--color-theme); }

.nav__link.active {
  border-bottom: 3px solid var(--color-theme);
  color: var(--color-theme);
  font-weight: 700;
}

.nav__submenu {
  background: var(--color-white);
  border: 1px solid #eee;
  border-top: 3px solid var(--color-theme);
  box-shadow: var(--shadow-md);
  left: 0;
  min-width: 200px;
  opacity: 0;
  position: absolute;
  top: 100%;
  transform: translateY(10px);
  transition: var(--transition);
  visibility: hidden;
}

.nav__item:hover > .nav__submenu {
  opacity: 1; transform: translateY(0);
  visibility: visible;
}

.nav__submenu .nav__link {
  border-bottom: 1px solid #f9f9f9;
  line-height: 1.5;
  padding: 10px 20px;
}

/* --- Mobile Menu --- */
.nav__toggle {
  cursor: pointer;
  display: none;
  height: 20px;
  position: relative;
  width: 28px;
}

.nav__toggle span {
  background: var(--color-dark);
  border-radius: 2px;
  display: block;
  height: 2px;
  position: absolute;
  transition: var(--transition);
  width: 100%;
}

.nav__toggle span:nth-child(1) { top: 0; }

.nav__toggle span:nth-child(2) { top: 9px; }

.nav__toggle span:nth-child(3) { bottom: 0; }

.nav__toggle.active span:nth-child(1) { top: 9px; transform: rotate(45deg); }

.nav__toggle.active span:nth-child(2) { opacity: 0; }

.nav__toggle.active span:nth-child(3) { bottom: 9px; transform: rotate(-45deg); }

@media (max-width: 768px) {
  .nav__toggle { display: block; }

  .nav {
    background: var(--color-white);
    height: calc(100vh - 60px);
    left: -100%;
    overflow-y: auto;
    padding: 20px 0;
    position: fixed;
    top: 60px;
    transition: var(--transition);
    width: 100%;
  }

  .nav.active { box-shadow: 5px 0 15px rgba(0,0,0,0.1); left: 0; }

  .nav__list { align-items: flex-start; flex-direction: column; }

  .nav__item { border-bottom: 1px solid #f5f5f5; width: 100%; }

  .nav__link { border-bottom: none; line-height: 50px; padding: 0 20px; width: 100%; }

  .nav__link.active { background: #e8f5e9; border-bottom: none; }

  .nav__submenu {
    background: #f9f9f9;
    border: none;
    border-top: none;
    box-shadow: none;
    max-height: 0;
    opacity: 1;
    overflow: hidden;
    position: static;
    transform: none;
    transition: max-height var(--transition);
    visibility: visible;
  }

  .nav__item.open > .nav__submenu { max-height: 500px; }
}

/* --- Layout --- */
.content { flex: 1 0 auto; padding: 30px 0; position: relative; }

/* --- Footer --- */
.footer {
  background: var(--color-white);
  border-top: 1px solid #eee;
  color: #999;
  flex-shrink: 0;
  font-size: 0.9rem;
  padding: 20px 0;
  text-align: center;
}

/* --- Modals --- */
.modal {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 420px;
  overflow: hidden;
  transform: scale(0.9);
  transition: var(--transition);
  width: 92%;
}

.modal-buttons {
  background: #f9f9f9;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 15px 20px;
}

.modal-overlay {
  align-items: center;
  background: rgba(0,0,0,0.5);
  display: flex;
  height: 100%;
  justify-content: center;
  left: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  top: 0;
  transition: var(--transition);
  visibility: hidden;
  width: 100%;
  z-index: 1000;
}

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

.modal-overlay.open .modal { transform: scale(1); }

/* --- Toasts --- */
.toast {
  background: var(--color-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  color: var(--color-white);
  font-size: 0.9rem;
  min-width: 240px;
  opacity: 0;
  padding: 12px 18px;
  transform: translateY(14px);
  transition: var(--transition);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error { border-left: 5px solid var(--color-red); }

.toast.success { border-left: 5px solid var(--color-green); }

.toast.warning { border-left: 5px solid var(--color-orange); }

.toast-container {
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: fixed;
  right: 20px;
  z-index: 2000;
}

/* --- Connection Status --- */
.status-indicator {
  background-color: #ccc;
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  transition: background-color 0.3s;
  width: 10px;
}

.status-indicator.offline { background-color: var(--color-red); }

.status-indicator.online {
  background-color: var(--color-green);
  box-shadow: 0 0 5px var(--color-green);
}

.status-indicator.socket {
  background-color: var(--color-blue);
  box-shadow: 0 0 5px var(--color-blue);
}

/* --- View Loader (cyberpunk / tech) --- */
.view-loader {
  align-items: center;
  background: rgba(10, 14, 22, 0.85);
  display: flex;
  height: 100%;
  justify-content: center;
  left: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  visibility: hidden;
  width: 100%;
  z-index: 100;
}

.view-loader.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.view-loader__inner {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
}

.view-loader__orb {
  animation: view-loader-orb 2.2s ease-in-out infinite;
  background: radial-gradient(circle at 35% 35%, rgba(0, 255, 255, 0.9), rgba(138, 43, 226, 0.6));
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(0, 255, 255, 0.4), 0 0 80px rgba(138, 43, 226, 0.2), inset 0 0 30px rgba(255, 255, 255, 0.1);
  height: 56px;
  width: 56px;
}

.view-loader__ring {
  animation: view-loader-rotate 3s linear infinite;
  border: 2px solid transparent;
  border-radius: 50%;
  border-top-color: rgba(0, 255, 255, 0.8);
  border-right-color: rgba(138, 43, 226, 0.5);
  height: 72px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
}

.view-loader__pulse {
  animation: view-loader-pulse 1.8s ease-out infinite;
  border: 2px solid rgba(0, 255, 255, 0.3);
  border-radius: 50%;
  height: 88px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 88px;
}

.view-loader__label {
  color: rgba(0, 255, 255, 0.85);
  font-family: "SF Mono", "Consolas", "Monaco", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
}

@keyframes view-loader-orb {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.05); }
}

@keyframes view-loader-rotate {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes view-loader-pulse {
  0% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.9); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); }
}

/* --- Helpers --- */
.contour { outline: 2px solid var(--color-red); }
.dev * { outline: 1px dashed rgba(46, 125, 50, 0.3); }
.lock { overflow: hidden; }
