/**
 * 98.css - IE5.5 Compatible Version
 * A Windows 98-style CSS framework compatible with Internet Explorer 5.5 and modern browsers
 * 
 * Uses progressive enhancement:
 * - Modern browsers get CSS variables, box-shadow, linear-gradient
 * - IE5.5 gets filter-based gradients and border-based 3D effects
 * - Both get the authentic Windows 98 look
 */

/* ===== CSS VARIABLES (Modern browsers only) ===== */

:root {
  /* Color */
  --text-color: #222222;
  --surface: #c0c0c0;
  --button-highlight: #ffffff;
  --button-face: #dfdfdf;
  --button-shadow: #808080;
  --window-frame: #0a0a0a;
  --dialog-blue: #000080;
  --dialog-blue-light: #1084d0;
  --dialog-gray: #808080;
  --dialog-gray-light: #b5b5b5;
  --link-blue: #0000ff;

  /* Spacing */
  --element-spacing: 8px;
  --grouped-element-spacing: 6px;
  --border-width: 1px;
}

/* ===== BODY AND TYPOGRAPHY ===== */

body {
  font-family: "MS Sans Serif", "Microsoft Sans Serif", Arial, sans-serif;
  font-size: 11px;
  /* IE5.5 fallback */
  color: #222222;
  background-color: #c0c0c0;
  /* Modern browsers */
  color: var(--text-color);
  background-color: var(--surface);
  margin: 0;
  padding: 0;
}

h1 {
  font-size: 24px;
  font-weight: bold;
}

h2 {
  font-size: 18px;
  font-weight: bold;
}

h3 {
  font-size: 16px;
  font-weight: bold;
}

h4 {
  font-size: 14px;
  font-weight: bold;
}

p {
  margin: 8px 0;
}

u {
  text-decoration: underline;
}

/* ===== BUTTONS ===== */

button,
input[type="submit"],
input[type="reset"] {
  font-family: "MS Sans Serif", "Microsoft Sans Serif", Arial, sans-serif;
  font-size: 11px;
  /* IE5.5 fallback */
  color: #222222;
  background-color: #dfdfdf;
  /* Modern browsers */
  color: var(--text-color);
  background-color: var(--button-face);
  border: none;
  padding: 3px 12px;
  min-width: 75px;
  cursor: pointer;
  
  /* IE5.5 3D border effect */
  border: 2px solid;
  border-top-color: #ffffff;
  border-left-color: #ffffff;
  border-right-color: #808080;
  border-bottom-color: #808080;
}

/* Modern browsers: use box-shadow for cleaner 3D effect */
@supports (box-shadow: inset 0 0 0 1px black) {
  button,
  input[type="submit"],
  input[type="reset"] {
    border: none;
    background: var(--button-face);
    box-shadow: 
      inset -1px -1px var(--window-frame),
      inset 1px 1px var(--button-highlight),
      inset -2px -2px var(--button-shadow),
      inset 2px 2px var(--button-face);
  }
}

button:active,
input[type="submit"]:active,
input[type="reset"]:active {
  /* IE5.5 fallback */
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #ffffff;
  border-bottom-color: #ffffff;
  padding: 4px 11px 2px 13px;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  button:active,
  input[type="submit"]:active,
  input[type="reset"]:active {
    border: none;
    padding: 3px 12px;
    box-shadow: 
      inset -1px -1px var(--button-highlight),
      inset 1px 1px var(--window-frame),
      inset -2px -2px var(--button-face),
      inset 2px 2px var(--button-shadow);
  }
}

button:focus,
input[type="submit"]:focus,
input[type="reset"]:focus {
  outline: 1px dotted #000000;
}

button:disabled,
input[type="submit"]:disabled,
input[type="reset"]:disabled {
  color: #808080;
  /* IE5.5 only - creates text shadow effect */
  filter: progid:DXImageTransform.Microsoft.dropshadow(offX=1,offY=1,color=#ffffff,positive=true);
}

/* Modern browsers */
@supports (text-shadow: 1px 1px 0 white) {
  button:disabled,
  input[type="submit"]:disabled,
  input[type="reset"]:disabled {
    color: var(--button-shadow);
    text-shadow: 1px 1px 0 var(--button-highlight);
    filter: none;
  }
}

/* ===== WINDOWS ===== */

.window {
  /* IE5.5 fallback */
  background-color: #c0c0c0;
  /* Modern browsers */
  background-color: var(--surface);
  padding: 2px;
  
  /* IE5.5 3D border */
  border: 2px solid;
  border-top-color: #dfdfdf;
  border-left-color: #dfdfdf;
  border-right-color: #0a0a0a;
  border-bottom-color: #0a0a0a;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  .window {
    border: none;
    padding: 3px;
    box-shadow: 
      inset -1px -1px var(--window-frame),
      inset 1px 1px var(--button-face),
      inset -2px -2px var(--button-shadow),
      inset 2px 2px var(--button-highlight);
  }
}

.title-bar {
  /* IE5.5 fallback */
  background-color: #000080;
  /* IE5.5 gradient using filter */
  filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr='#000080', endColorStr='#1084d0', gradientType='1');
  padding: 2px 3px;
  color: #ffffff;
  font-weight: bold;
  margin-bottom: 2px;
}

/* Modern browsers */
@supports (background: linear-gradient(to right, blue, red)) {
  .title-bar {
    background: linear-gradient(
      90deg,
      var(--dialog-blue),
      var(--dialog-blue-light)
    );
    filter: none;
    padding: 3px 2px 3px 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

.title-bar.inactive {
  /* IE5.5 fallback */
  background-color: #808080;
  filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr='#808080', endColorStr='#b5b5b5', gradientType='1');
}

/* Modern browsers */
@supports (background: linear-gradient(to right, blue, red)) {
  .title-bar.inactive {
    background: linear-gradient(
      90deg,
      var(--dialog-gray),
      var(--dialog-gray-light)
    );
    filter: none;
  }
}

.title-bar-text {
  color: #ffffff;
  font-weight: bold;
  float: left;
  margin-right: 24px;
}

.title-bar-controls {
  float: right;
}

.title-bar-controls button {
  width: 16px;
  height: 14px;
  min-width: 16px;
  padding: 0;
  margin-left: 2px;
  font-size: 8px;
  font-weight: bold;
}

.title-bar-controls .minimize {
  /* Underscore for minimize */
}

.title-bar-controls .maximize {
  /* Square for maximize */
}

.title-bar-controls .close {
  margin-left: 2px;
}

.window-body {
  /* IE5.5 fallback */
  margin: 8px;
  /* Modern browsers */
  margin: var(--element-spacing);
  clear: both;
}

/* ===== STATUS BAR ===== */

.status-bar {
  margin: 2px 1px;
  /* IE5.5 fallback - no flexbox */
  border: 1px solid;
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #dfdfdf;
  border-bottom-color: #dfdfdf;
}

/* Modern browsers */
@supports (display: flex) {
  .status-bar {
    border: none;
    display: flex;
    gap: 1px;
  }
}

.status-bar-field {
  padding: 2px 3px;
  /* IE5.5 fallback */
  border: 1px solid;
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #dfdfdf;
  border-bottom-color: #dfdfdf;
  margin: 1px;
  display: inline-block;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  .status-bar-field {
    border: none;
    box-shadow: 
      inset -1px -1px var(--button-face),
      inset 1px 1px var(--button-shadow);
    flex-grow: 1;
    margin: 0;
  }
}

/* ===== FORM ELEMENTS ===== */

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
  font-family: "MS Sans Serif", "Microsoft Sans Serif", Arial, sans-serif;
  font-size: 11px;
  /* IE5.5 fallback */
  color: #222222;
  background-color: #ffffff;
  /* Modern browsers */
  color: var(--text-color);
  padding: 2px 3px;
  
  /* IE5.5 3D border */
  border: 2px solid;
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #dfdfdf;
  border-bottom-color: #dfdfdf;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  input[type="text"],
  input[type="password"],
  input[type="email"],
  textarea,
  select {
    border: none;
    box-shadow: 
      inset -1px -1px var(--button-highlight),
      inset 1px 1px var(--button-shadow),
      inset -2px -2px var(--button-face),
      inset 2px 2px var(--window-frame);
  }
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
  outline: none;
}

input[type="text"]:disabled,
input[type="password"]:disabled,
input[type="email"]:disabled,
textarea:disabled,
select:disabled {
  /* IE5.5 fallback */
  background-color: #c0c0c0;
  color: #808080;
  /* Modern browsers */
  background-color: var(--surface);
  color: var(--button-shadow);
}

textarea {
  resize: none;
}

select {
  padding: 0 2px;
  height: 21px;
}

/* ===== CHECKBOXES AND RADIO BUTTONS ===== */

input[type="checkbox"],
input[type="radio"] {
  width: 13px;
  height: 13px;
  margin: 0 6px 0 0;
  vertical-align: middle;
}

label {
  vertical-align: middle;
  cursor: pointer;
}

/* ===== FIELDSET AND LEGEND ===== */

fieldset {
  /* IE5.5 fallback */
  border: 2px groove #dfdfdf;
  /* Modern browsers */
  padding: 8px;
  padding: var(--element-spacing);
  margin: 0 0 8px 0;
}

legend {
  /* IE5.5 fallback */
  background-color: #c0c0c0;
  /* Modern browsers */
  background-color: var(--surface);
  padding: 0 4px;
  font-weight: normal;
}

/* ===== LISTS ===== */

ul,
ol {
  margin: 8px 0;
  padding-left: 24px;
}

li {
  margin: 2px 0;
}

/* ===== LINKS ===== */

a {
  /* IE5.5 fallback */
  color: #0000ff;
  /* Modern browsers */
  color: var(--link-blue);
  text-decoration: underline;
}

a:visited {
  color: #800080;
}

a:hover {
  color: #ff0000;
}

/* ===== TABLES ===== */

table {
  border-collapse: collapse;
  border: 1px solid #808080;
}

th,
td {
  border: 1px solid #808080;
  padding: 4px 8px;
  text-align: left;
}

th {
  background-color: #dfdfdf;
  font-weight: bold;
}

/* ===== TOOLBAR ===== */

.toolbar {
  /* IE5.5 fallback */
  background-color: #c0c0c0;
  /* Modern browsers */
  background-color: var(--surface);
  padding: 4px;
  border-bottom: 1px solid #808080;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  .toolbar {
    border-bottom-color: var(--button-shadow);
  }
}

.toolbar button {
  margin-right: 2px;
  padding: 4px 8px;
  min-width: 0;
}

/* ===== MENU BAR ===== */

.menu-bar {
  /* IE5.5 fallback */
  background-color: #c0c0c0;
  /* Modern browsers */
  background-color: var(--surface);
  padding: 2px;
  border-bottom: 1px solid #808080;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  .menu-bar {
    border-bottom-color: var(--button-shadow);
  }
}

.menu-bar button {
  background-color: transparent;
  border: 1px solid transparent;
  padding: 2px 8px;
  min-width: 0;
}

.menu-bar button:hover {
  /* IE5.5 3D border */
  border: 1px solid;
  border-top-color: #ffffff;
  border-left-color: #ffffff;
  border-right-color: #808080;
  border-bottom-color: #808080;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  .menu-bar button:hover {
    border: none;
    box-shadow: 
      inset -1px -1px var(--window-frame),
      inset 1px 1px var(--button-highlight);
  }
}

.menu-bar button:active {
  /* IE5.5 fallback */
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #ffffff;
  border-bottom-color: #ffffff;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  .menu-bar button:active {
    border: none;
    box-shadow: 
      inset -1px -1px var(--button-highlight),
      inset 1px 1px var(--window-frame);
  }
}

/* ===== TABS ===== */

.tabs {
  margin-bottom: -2px;
}

.tabs button {
  /* IE5.5 fallback */
  background-color: #c0c0c0;
  /* Modern browsers */
  background-color: var(--surface);
  padding: 4px 12px;
  margin-right: 2px;
  min-width: 0;
  
  /* IE5.5 3D border */
  border: 2px solid;
  border-top-color: #ffffff;
  border-left-color: #ffffff;
  border-right-color: #808080;
  border-bottom-color: transparent;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  .tabs button {
    border: none;
    border-bottom: 2px solid var(--surface);
    box-shadow: 
      inset -1px 0 var(--window-frame),
      inset 1px 1px var(--button-face),
      inset -2px 0 var(--button-shadow),
      inset 2px 2px var(--button-highlight);
  }
}

.tabs button.active {
  /* IE5.5 fallback */
  background-color: #dfdfdf;
  border-bottom-color: #dfdfdf;
  /* Modern browsers */
  background-color: var(--button-face);
  padding-bottom: 6px;
  margin-bottom: -2px;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  .tabs button.active {
    border-bottom-color: var(--button-face);
  }
}

/* ===== SCROLLBAR (Limited IE5.5 styling) ===== */

/* IE5.5 supports basic scrollbar coloring */
body {
  scrollbar-base-color: #c0c0c0;
  scrollbar-face-color: #dfdfdf;
  scrollbar-3dlight-color: #ffffff;
  scrollbar-highlight-color: #ffffff;
  scrollbar-track-color: #c0c0c0;
  scrollbar-arrow-color: #000000;
  scrollbar-shadow-color: #808080;
  scrollbar-dark-shadow-color: #000000;
}

/* ===== UTILITY CLASSES ===== */

.field-row {
  /* IE5.5 fallback */
  margin-bottom: 8px;
  /* Modern browsers */
  margin-bottom: var(--grouped-element-spacing);
}

/* Modern browsers - flex layout */
@supports (display: flex) {
  .field-row {
    display: flex;
    align-items: center;
  }
  
  .field-row > * + * {
    margin-left: var(--grouped-element-spacing);
  }
}

.field-row-stacked {
  /* IE5.5 fallback */
  margin-bottom: 8px;
  /* Modern browsers */
  margin-bottom: var(--grouped-element-spacing);
}

/* Modern browsers */
@supports (display: flex) {
  .field-row-stacked {
    display: flex;
    flex-direction: column;
  }
  
  .field-row-stacked * + * {
    margin-top: var(--grouped-element-spacing);
  }
}

.sunken-panel {
  padding: 8px;
  background-color: #ffffff;
  
  /* IE5.5 3D border */
  border: 2px solid;
  border-top-color: #808080;
  border-left-color: #808080;
  border-right-color: #dfdfdf;
  border-bottom-color: #dfdfdf;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  .sunken-panel {
    border: none;
    box-shadow: 
      inset -1px -1px var(--button-highlight),
      inset 1px 1px var(--button-shadow),
      inset -2px -2px var(--button-face),
      inset 2px 2px var(--window-frame);
  }
}

.raised-panel {
  padding: 8px;
  /* IE5.5 fallback */
  background-color: #c0c0c0;
  /* Modern browsers */
  background-color: var(--surface);
  
  /* IE5.5 3D border */
  border: 2px solid;
  border-top-color: #ffffff;
  border-left-color: #ffffff;
  border-right-color: #808080;
  border-bottom-color: #808080;
}

/* Modern browsers */
@supports (box-shadow: inset 0 0 0 1px black) {
  .raised-panel {
    border: none;
    box-shadow: 
      inset -1px -1px var(--window-frame),
      inset 1px 1px var(--button-highlight),
      inset -2px -2px var(--button-shadow),
      inset 2px 2px var(--button-face);
  }
}

/* ===== GROUPBOX (Alternative to fieldset) ===== */

.groupbox {
  border: 2px groove #dfdfdf;
  padding: 12px 8px 8px 8px;
  margin: 0 0 8px 0;
  position: relative;
}

.groupbox-label {
  position: absolute;
  top: -8px;
  left: 8px;
  /* IE5.5 fallback */
  background-color: #c0c0c0;
  /* Modern browsers */
  background-color: var(--surface);
  padding: 0 4px;
}

/* ===== HELPER CLASSES ===== */

.clearfix {
  /* IE5.5 clearfix hack */
  height: 1%;
}

.clearfix:after {
  content: ".";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}
