/* =====================================================
   ULASIX RECORDING SYSTEM - Main Stylesheet v2
   Location: /www/wwwroot/ulasix.online/assets/css/style.css
   ===================================================== */

:root {
  --bg-primary:    #0f172a;
  --bg-secondary:  #1e293b;
  --bg-tertiary:   #334155;
  --bg-hover:      #2d3a52;
  --border:        #334155;
  --border-light:  #475569;
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;
  --brand:         #38bdf8;
  --brand-dark:    #0ea5e9;
  --success:       #10b981;
  --success-bg:    #064e3b;
  --warning:       #f59e0b;
  --warning-bg:    #78350f;
  --danger:        #ef4444;
  --danger-bg:     #7f1d1d;
  --info:          #6366f1;
  --info-bg:       #1e1b4b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background: var(--bg-primary); color: var(--text-primary);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
button { font-family: inherit; }

/* Login */
.login-bg {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(56,189,248,.1), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(99,102,241,.1), transparent 40%),
    var(--bg-primary);
}
.login-box {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo .icon { font-size: 48px; margin-bottom: 8px; }
.login-logo h1 { color: var(--brand); font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-form .field { margin-bottom: 18px; }
.login-form label {
  display: block; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; margin-bottom: 6px;
}
.login-form input {
  width: 100%; padding: 12px 14px;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 14px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.login-form input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
.btn-login {
  width: 100%; padding: 12px 20px;
  background: var(--brand); color: var(--bg-primary);
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .2s, transform .1s; margin-top: 6px;
}
.btn-login:hover { background: var(--brand-dark); }
.btn-login:active { transform: scale(0.98); }
.login-footer { text-align: center; margin-top: 24px; color: var(--text-muted); font-size: 12px; }

/* Alert */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 18px; font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.alert-error    { background: var(--danger-bg);  color: #fca5a5; border: 1px solid var(--danger); }
.alert-success  { background: var(--success-bg); color: #6ee7b7; border: 1px solid var(--success); }
.alert-warning  { background: var(--warning-bg); color: #fcd34d; border: 1px solid var(--warning); }
.alert-info     { background: var(--info-bg);    color: #bfdbfe; border: 1px solid var(--info); }

/* App Layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar {
  background: var(--bg-secondary); border-right: 1px solid var(--border);
  padding: 20px 0; display: flex; flex-direction: column;
}
.sidebar-logo {
  padding: 0 24px 20px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.sidebar-logo h1 {
  color: var(--brand); font-size: 20px; font-weight: 700; letter-spacing: -.3px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-logo span { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.sidebar-nav { flex: 1; padding: 0 12px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; color: var(--text-secondary);
  border-radius: var(--radius); font-size: 14px; font-weight: 500;
  margin-bottom: 2px; transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-nav a.active { background: var(--brand); color: var(--bg-primary); }
.sidebar-nav .icon { width: 18px; text-align: center; }
.sidebar-section {
  padding: 18px 26px 8px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted); font-weight: 600;
}

/* Main */
.main { display: flex; flex-direction: column; overflow: auto; }
.topbar {
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex;
  align-items: center; justify-content: space-between;
}
.topbar .page-title { font-size: 18px; font-weight: 600; }
.topbar .user-menu { display: flex; align-items: center; gap: 14px; }
.topbar .user-menu .username { font-size: 13px; color: var(--text-secondary); }
.topbar .user-menu .badge-role {
  background: var(--brand); color: var(--bg-primary);
  padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.btn-logout {
  background: transparent; border: 1px solid var(--border-light);
  color: var(--text-secondary); padding: 6px 14px; border-radius: var(--radius);
  font-size: 13px; cursor: pointer; transition: all .2s;
  text-decoration: none; display: inline-block;
}
.btn-logout:hover {
  background: var(--danger-bg); border-color: var(--danger); color: #fca5a5;
}
.content { padding: 28px; flex: 1; }

/* Card */
.card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s; text-decoration: none;
  font-family: inherit;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--bg-primary); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary {
  background: var(--bg-tertiary); color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-ghost {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon {
  padding: 6px; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }

/* Table */
.table-wrap {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  background: var(--bg-primary); color: var(--text-secondary);
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; text-align: left; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-hover); }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.table-empty {
  padding: 60px 20px; text-align: center; color: var(--text-muted);
}
.table-empty .icon { font-size: 48px; margin-bottom: 12px; opacity: .3; }

/* Badge */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
}
.badge-success { background: var(--success-bg); color: #6ee7b7; }
.badge-danger  { background: var(--danger-bg);  color: #fca5a5; }
.badge-warning { background: var(--warning-bg); color: #fcd34d; }
.badge-info    { background: var(--info-bg);    color: #bfdbfe; }
.badge-muted   { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-online::before, .badge-offline::before { content: '●'; margin-right: 4px; }
.badge-online  { background: var(--success-bg); color: #6ee7b7; }
.badge-online::before { color: var(--success); }
.badge-offline { background: var(--bg-tertiary); color: var(--text-muted); }

/* Form */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
}
.form-label .required { color: var(--danger); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 14px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
.form-input[readonly] { background: var(--bg-tertiary); cursor: not-allowed; }
.form-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 600px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease-out;
}
@keyframes modalIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-lg { max-width: 720px; }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 24px; cursor: pointer; padding: 0; line-height: 1;
  transition: color .2s;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* Toast */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 2000; display: flex; flex-direction: column; gap: 8px;
  max-width: 400px;
}
.toast {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  animation: toastIn .2s ease-out;
  border-left: 3px solid var(--brand);
}
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.toast.fade-out { opacity: 0; transition: opacity .3s; }

/* Page Header */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; }

/* Search */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px;
  margin-bottom: 16px; max-width: 400px;
}
.search-bar input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: 13px; font-family: inherit;
}

/* Code */
code {
  background: var(--bg-primary); padding: 2px 8px;
  border-radius: var(--radius-sm); color: var(--brand);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 12px;
}
.copy-target { cursor: pointer; transition: background .2s; user-select: all; }
.copy-target:hover { background: var(--bg-hover); }

/* Placeholder */
.placeholder { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.placeholder .icon { font-size: 64px; margin-bottom: 16px; opacity: .4; }
.placeholder h2 { color: var(--text-secondary); margin-bottom: 8px; }

/* Mobile */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .login-box { padding: 30px 24px; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
  .table th, .table td { padding: 10px 8px; font-size: 12px; }
}
