/*
 * ShinyProxy Minimal CSS
 * Bootstrap-free replacement for ShinyProxy's app.html
 * Only includes styles needed for loading screens, buttons, forms, and alerts
 */

/* ============================================================================
   Base / Reset - Override ShinyProxy's default.css
   ============================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0 !important;
  padding: 0 !important;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
}

/* Hide ShinyProxy navbar and any wrapper elements */
body > nav,
body > .navbar,
body > header,
#navbar,
.navbar,
.sp-navbar,
nav.navbar {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure iframe fills the viewport from absolute top */
#iframeinsert {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

#iframeinsert iframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ============================================================================
   Layout (Bootstrap grid replacement)
   ============================================================================ */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 15px;
}

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

.row > * {
  padding: 0 15px;
  width: 100%;
}

/* Form columns - desktop */
@media (min-width: 576px) {
  .col-sm-2 {
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
  }
  .col-sm-10 {
    flex: 0 0 83.333333%;
    max-width: 83.333333%;
  }
  .col-sm-offset-2 {
    margin-left: 16.666667%;
  }
}

/* ============================================================================
   Buttons
   ============================================================================ */
.btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: all 0.15s ease-in-out;
}

.btn-default {
  color: #333;
  background-color: #fff;
  border-color: #ccc;
}

.btn-default:hover {
  color: #333;
  background-color: #e6e6e6;
  border-color: #adadad;
}

.btn-success {
  color: #fff;
  background-color: #5cb85c;
  border-color: #4cae4c;
}

.btn-success:hover {
  color: #fff;
  background-color: #449d44;
  border-color: #398439;
}

/* ============================================================================
   Forms
   ============================================================================ */
.form-horizontal {
  width: 100%;
}

.form-group {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 15px;
  align-items: flex-start;
}

.control-label {
  padding-top: 7px;
  margin-bottom: 0;
  text-align: right;
  font-weight: 600;
}

@media (max-width: 575px) {
  .control-label {
    text-align: left;
    margin-bottom: 5px;
  }
}

.form-control {
  display: block;
  width: 100%;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #555;
  background-color: #fff;
  background-image: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  transition: border-color 0.15s ease-in-out;
}

.form-control:focus {
  border-color: #66afe9;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(102, 175, 233, 0.25);
}

.help-block {
  display: block;
  margin-top: 5px;
  color: #737373;
  font-size: 12px;
}

/* ============================================================================
   Alerts
   ============================================================================ */
.alert {
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid transparent;
  border-radius: 4px;
}

.alert-danger {
  color: #a94442;
  background-color: #f2dede;
  border-color: #ebccd1;
}

/* ============================================================================
   Loading screens (keep existing ShinyProxy styles, enhance if needed)
   ============================================================================ */
.loading {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.loading-txt {
  text-align: center;
  font-size: 18px;
  color: #333;
  padding: 20px;
}

.loading-img {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.refreshButton {
  margin-top: 10px;
}

/* Parameter form visibility */
#parameterForm {
  display: none;
  padding: 40px 20px;
}

#selectAllWarning {
  display: none;
}
