/* ---------- AOL Instant Messenger (AIM 5.x style) ---------- */
.window-body.aim-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0 3px 3px !important;
  padding: 0 !important;
  overflow: hidden !important;
}
.aim-body > .window-content.aim {
  flex: 1;
  width: auto;
  padding: 0;
  overflow: hidden;
  display: flex;
  min-height: 0;
  background: #ece9d8;
  font: 11px Tahoma, "Segoe UI", sans-serif;
  color: #000;
}
.aim [hidden] { display: none !important; }
.aim button { font: 11px Tahoma, sans-serif; }

/* ---------- Sign On ---------- */
.aim-signon {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: linear-gradient(#fff 0, #fff 150px, #ece9d8 150px);
}
.aim-signon-logo {
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-bottom: 1px solid #b9b39c;
  background: radial-gradient(ellipse at 50% 40%, #fff9d6, #fff 70%);
}
.aim-signon-logo img { width: 84px; height: 84px; }
.aim-signon-logo.running img { animation: aim-run .5s ease-in-out infinite alternate; }
@keyframes aim-run { from { transform: translateX(-6px) rotate(-4deg); } to { transform: translateX(6px) rotate(4deg); } }
.aim-wordmark { font: bold 22px Arial, sans-serif; letter-spacing: 1px; color: #0a2a7a; }
.aim-wordmark small { font-size: 10px; letter-spacing: 0; color: #666; font-weight: normal; margin-left: 2px; }

.aim-signon-form { padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; }
.aim-signon-form label { font-weight: bold; color: #0a2a7a; margin-top: 4px; }
.aim-signon-form input[type="text"],
.aim-signon-form input[type="password"] { width: 100%; box-sizing: border-box; }
.aim-signon-form .aim-link { color: #0000cc; text-decoration: underline; cursor: pointer; font-weight: normal; font-size: 10px; }
.aim-checks { display: flex; gap: 10px; margin-top: 6px; }
.aim-checks label { font-weight: normal; color: #000; margin: 0; display: flex; align-items: center; gap: 3px; }
.aim-signon-foot { margin-top: auto; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; }
.aim-signon-foot .aim-ver { color: #666; font-size: 10px; }
.aim-signon-foot button { font-weight: bold; min-width: 80px; }
.aim-connect { padding: 16px 14px; line-height: 1.8; }
.aim-connect div { color: #999; }
.aim-connect div.on { color: #000; font-weight: bold; }
.aim-connect div.done { color: #0a7a1a; }

/* ---------- Signed-on layout ---------- */
.aim-online { flex: 1; display: flex; min-width: 0; min-height: 0; }

/* Buddy list */
.aim-bl {
  width: 190px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #b9b39c;
  min-height: 0;
}
.aim-menubar { display: flex; height: 19px; align-items: center; border-bottom: 1px solid #d8d2bd; flex-shrink: 0; }
.aim-menubar span { padding: 1px 6px; cursor: default; }
.aim-menubar span:hover { background: #316ac5; color: #fff; }

.aim-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  background: linear-gradient(#fffbe0, #ffe98a);
  border-bottom: 1px solid #c9b153;
  flex-shrink: 0;
}
.aim-banner img { width: 30px; height: 30px; }
.aim-banner-name { font-weight: bold; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aim-banner-status { color: #555; cursor: pointer; }
.aim-banner-status:hover { text-decoration: underline; }
.aim-banner > div { min-width: 0; }

.aim-bl-tabs { display: flex; padding: 4px 4px 0; gap: 2px; flex-shrink: 0; }
.aim-bl-tabs span {
  padding: 2px 10px;
  border: 1px solid #919b9c;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(#fff, #ece9d8);
}
.aim-bl-tabs span.active { background: #fff; font-weight: bold; position: relative; top: 1px; }

.aim-tree {
  flex: 1;
  overflow-y: auto;
  margin: 0 4px;
  border: 1px solid #919b9c;
  background: #fff;
  padding: 3px 0;
  min-height: 0;
}
.aim-group { font-weight: bold; padding: 1px 4px; cursor: pointer; white-space: nowrap; }
.aim-group::before { content: "\25BE"; display: inline-block; width: 12px; color: #444; }
.aim-group.collapsed::before { content: "\25B8"; }
.aim-group.collapsed + .aim-group-items { display: none; }
.aim-buddy {
  padding: 1px 4px 1px 18px;
  cursor: default;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}
.aim-buddy img { width: 14px; height: 14px; border-radius: 2px; flex-shrink: 0; }
.aim-buddy:hover { background: #e8eefa; }
.aim-buddy.sel { background: #316ac5; color: #fff; }
.aim-buddy.away { color: #888; font-style: italic; }
.aim-buddy.new { animation: aim-signin 1.5s ease-out; }
@keyframes aim-signin { 0%, 60% { font-weight: bold; background: #fff4b3; } }
.aim-buddy.empty { color: #888; font-style: italic; }

.aim-bl-tools {
  display: flex;
  justify-content: space-around;
  padding: 4px 2px;
  flex-shrink: 0;
}
.aim-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 2px 4px;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
}
.aim-tool:hover { border-color: #c9c3ad; background: #fff; }
.aim-tool:active { background: #e3dfcf; }
.aim-tool i { font-style: normal; font-size: 16px; line-height: 18px; }

/* Conversation pane */
.aim-conv { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 4px; gap: 4px; }
.aim-conv-tabs { display: flex; gap: 2px; flex-shrink: 0; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid #919b9c; padding: 0 2px; }
.aim-conv-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid #919b9c;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(#fff, #e3dfcf);
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
}
.aim-conv-tab.active { background: #fff; font-weight: bold; border-bottom: 1px solid #fff; }
.aim-conv-tab.flash { animation: aim-flash 0.8s steps(1) infinite; }
@keyframes aim-flash { 50% { background: #ff9c33; color: #fff; } }
.aim-conv-tab .x { font-weight: normal; color: #666; padding: 0 2px; }
.aim-conv-tab .x:hover { color: #c00; }

.aim-conv-body { flex: 1; display: flex; gap: 4px; min-height: 0; }
.aim-log {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #7f9db9;
  padding: 4px 6px;
  font: 13px Arial, sans-serif;
  min-width: 0;
  user-select: text;
  word-wrap: break-word;
}
.aim-line { margin: 1px 0; }
.aim-line .who { font-weight: bold; }
.aim-line .who.me { color: #f00; }
.aim-line .who.them { color: #00f; }
.aim-line .ts { color: #888; font-size: 11px; font-weight: normal; }
.aim-line.sys { color: #666; font-style: italic; font-size: 12px; }
.aim-line.auto .who::after { content: " (Auto-Response)"; font-weight: normal; }
.aim-emo { font-style: normal; }

.aim-members {
  width: 110px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #7f9db9;
  overflow-y: auto;
  padding: 2px 0;
}
.aim-members-head { font-weight: bold; padding: 1px 5px 3px; border-bottom: 1px solid #ddd; margin-bottom: 2px; }
.aim-members .aim-buddy { padding-left: 5px; }

.aim-fmt { display: flex; gap: 2px; align-items: center; flex-shrink: 0; position: relative; }
.aim-fmt button {
  min-width: 0;
  min-height: 0;
  width: 24px;
  height: 22px;
  padding: 0;
  font: 12px "Times New Roman", serif;
}
.aim-fmt button.on { background: #cfd8ea; box-shadow: inset 1px 1px 2px rgba(0,0,0,.35); }
.aim-fmt .aim-color-swatch { display: block; width: 14px; height: 4px; margin: 0 auto; }
.aim-popup {
  position: absolute;
  bottom: 24px;
  z-index: 5;
  background: #fff;
  border: 1px solid #7f9db9;
  box-shadow: 2px 2px 4px rgba(0,0,0,.3);
  padding: 3px;
  display: grid;
  gap: 2px;
}
.aim-popup.colors { grid-template-columns: repeat(6, 16px); }
.aim-popup.colors span { width: 16px; height: 16px; cursor: pointer; border: 1px solid #999; box-sizing: border-box; }
.aim-popup.smileys { grid-template-columns: repeat(6, 22px); }
.aim-popup.smileys span { font-size: 16px; text-align: center; cursor: pointer; border-radius: 2px; }
.aim-popup span:hover { outline: 1px solid #316ac5; }

.aim-input {
  height: 54px;
  flex-shrink: 0;
  resize: none;
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #7f9db9;
  padding: 3px 5px;
  font: 13px Arial, sans-serif;
}
.aim-input:focus { outline: none; }
.aim-conv-foot { display: flex; justify-content: flex-end; gap: 4px; flex-shrink: 0; }
.aim-conv-foot button { min-width: 64px; }
.aim-conv-foot .aim-send { font-weight: bold; }

/* Away message dialog */
.aim-away {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.aim-away-box {
  background: #ece9d8;
  border: 1px solid #0831d9;
  box-shadow: 2px 2px 8px rgba(0,0,0,.4);
  width: 230px;
}
.aim-away-box .ttl { background: linear-gradient(#0a5ce8, #0848c8); color: #fff; font-weight: bold; padding: 3px 6px; }
.aim-away-box .in { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.aim-away-box textarea { height: 60px; resize: none; font: 12px Arial, sans-serif; }
.aim-away-box .btns { display: flex; justify-content: flex-end; gap: 4px; }

.aim-online { position: relative; }

/* Narrow window: stack only the conversation or the buddy list */
.aim.narrow .aim-members { display: none; }
