/******************************
 * Global Reset & Body
 ******************************/
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #008080;
    /* Classic Win98 teal */
    font-family: "MS Sans Serif", "Arial", sans-serif;
    font-size: 12px;
    color: #000;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* Hide browser scroll; emulate a desktop */
    position: relative;
    user-select: none;
    /* So we don't accidentally select text when dragging windows */
}

/******************************
 * Window / Title Bars
 ******************************/
.window {
    position: absolute;
    border: 2px solid #000;
    background-color: #C0C0C0;
    box-shadow: 3px 3px 0px #666;
    width: 420px;
}

/* Prevent windows from extending under the taskbar or out of the viewport */
.window {
    max-height: calc(100vh - 40px);
}

.title-bar {
    background: linear-gradient(to bottom, #000080, #000060);
    color: #fff;
    padding: 2px 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    /* Indicate draggable on the title bar */
}

.title-bar-text {
    display: flex;
    align-items: center;
    font-weight: bold;
    gap: 8px;
    font-size: 12px;
}

.title-icon {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.title-bar-controls {
    display: flex;
    gap: 2px;
}

.title-bar-controls button {
    cursor: pointer;
    width: 16px;
    height: 16px;
    border: 1px outset #C0C0C0;
    background-color: #C0C0C0;
    position: relative;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'MS Sans Serif', sans-serif;
}

.title-bar-controls button:active {
    border: 1px inset #C0C0C0;
}

/* Min / Max / Close icons using text or shapes */
.min-btn {
    font-weight: bold;
    color: #000;
    font-size: 16px;
    line-height: 8px;
}

.min-btn::after {
    content: "_";
    position: relative;
    top: -4px;
}

.max-btn {
    font-weight: bold;
    color: #000;
    font-size: 14px;
    line-height: 14px;
}

.max-btn::after {
    content: "□";
}

.close-btn {
    font-weight: bold;
    color: #000;
    font-size: 11px;
    line-height: 14px;
}

.close-btn::after {
    content: "×";
}

.window-body {
    padding: 10px;
}

/* Positioning some windows for demo */
#splash-screen {
    /* will be centered via the grouped centered rule below; keep a default width */
    width: 340px;
}

/* Center key modal-like windows horizontally and vertically */
#dialup-screen,
#dialup-connecting,
#splash-screen {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    z-index: 2000;
}

#login-screen,
#register-screen {
    top: 100px;
    left: calc(50% - 150px);
    width: 300px;
}

#icq-main {
    top: 40px;
    left: 40px;
    /* Make main ICQ window responsive so lists don't fall off the bottom */
    width: 540px;
    height: calc(100vh - 100px);
    min-height: 420px;
}

.hidden {
    display: none;
}

.minimized {
    display: none;
}

/******************************
 * Splash Screen
 ******************************/
.splash-body {
    text-align: center;
    padding: 20px;
}

.icq-splash-logo {
    width: 64px;
    height: 64px;
    margin: 10px auto;
    display: block;
}

.loading-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 15px 0;
}

.icq-loading-animation {
    width: 24px;
    height: 24px;
}

.loading-text {
    font-size: 12px;
    color: #333;
}

.icq-loading-animation::-webkit-media-controls {
    display: none !important;
}

.icq-loading-animation::-webkit-media-controls-enclosure {
    display: none !important;
}

.splash-text {
    font-weight: bold;
    margin-top: 10px;
}

.splash-subtext {
    font-size: 11px;
    margin-bottom: 15px;
    color: #333;
}

.login-progress-container {
    width: 200px;
    margin: 15px auto;
}

.progress-bar-container {
    width: 100%;
    height: 20px;
    border: 2px inset #999;
    background: #C0C0C0;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, #0080C0, #00A0FF);
    width: 0%;
    transition: width 0.1s linear;
}

/******************************
 * Login & Register
 ******************************/
.login-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.icq-logo {
    width: 64px;
    height: 64px;
    margin: 10px auto;
    display: block;
}

.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    margin-top: 10px;
}

.login-form label {
    margin-top: 10px;
    font-weight: bold;
}

.login-form input {
    margin-bottom: 5px;
    padding: 3px;
    border: 1px inset #888;
    background: #fff;
}

/******************************
 * Registration Screens
 ******************************/
#register-screen {
    width: 520px;
    height: auto;
}

#register-details-screen,
#register-complete-screen {
    width: 580px;
    height: auto;
    max-height: calc(100vh - 100px);
}

.registration-body {
    display: flex;
    padding: 0;
    min-height: 300px;
}

.registration-left-panel {
    width: 80px;
    background: linear-gradient(to bottom, #0080C0, #0060A0);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px;
    border-right: 2px solid #000;
}

.registration-logo {
    width: 50px;
    height: 50px;
    margin-bottom: 20px;
}

.registration-number-display {
    color: white;
    font-size: 16px;
    font-weight: bold;
    margin-top: 20px;
}

.registration-right-panel {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.registration-section {
    margin-bottom: 20px;
}

.registration-section h3 {
    color: #000080;
    font-size: 12px;
    margin: 0 0 10px 0;
    font-weight: bold;
}

.connection-type-options {
    background: #E0E0E0;
    border: 2px inset #999;
    padding: 15px;
}

.connection-icon {
    font-size: 32px;
    text-align: center;
    margin: 10px 0;
}

.connection-type-options label {
    display: block;
    margin: 8px 0;
    font-size: 11px;
}

.hint-text {
    font-size: 10px;
    color: #333;
    margin: 5px 0;
    font-style: italic;
}

.registration-button-container {
    margin: 15px 0;
}

.registration-btn {
    width: 100%;
    text-align: left;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: #C0C0C0;
    border: 2px outset #fff;
}

.registration-btn:hover {
    background: #D0D0D0;
}

.btn-label {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 5px;
}

.btn-description {
    font-size: 10px;
    color: #333;
}

.registration-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 15px;
    border-bottom: 2px solid #000080;
}

.registration-tab {
    padding: 5px 15px;
    background: #C0C0C0;
    border: 1px solid #808080;
    font-size: 11px;
    cursor: pointer;
}

.registration-tab.active {
    background: #E0E0E0;
    border-bottom: 2px solid #E0E0E0;
    margin-bottom: -2px;
    font-weight: bold;
}

.registration-form-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.form-group {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.form-group label {
    width: 100px;
    font-size: 11px;
    font-weight: bold;
}

.form-group input {
    padding: 3px;
    border: 1px inset #888;
    background: #fff;
    font-size: 11px;
}

.registration-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #808080;
    background: #C0C0C0;
}

/******************************
 * Buttons
 ******************************/
.btn {
    background-color: #C0C0C0;
    border: 1px outset #fff;
    padding: 3px 8px;
    cursor: pointer;
    font-family: "MS Sans Serif", "Arial", sans-serif;
    font-size: 12px;
    margin-top: 8px;
}

.btn:hover {
    background-color: #eee;
}

.btn:active {
    border: 1px inset #ccc;
}

.small-btn {
    padding: 2px 6px;
    font-size: 11px;
    margin: 0;
}

/******************************
 * Main Interface
 ******************************/
.main-body {
    display: flex;
    height: 100%;
    padding: 5px;
    overflow: hidden;
}

.sidebar {
    width: 170px;
    border-right: 2px solid #000;
    padding: 5px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Ensure window body can scroll internally if content is taller than the window */
.window .window-body {
    max-height: calc(100vh - 120px);
    overflow: auto;
}

.status-bar {
    margin-bottom: 10px;
}

.status-bar select {
    width: 100%;
    margin-top: 5px;
    font-size: 12px;
    background: #fff;
    border: 1px inset #888;
}

.user-list-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0; /* allow flex children to shrink properly */
    overflow: hidden;
}

.user-list-panel h4 {
    font-size: 11px;
    margin: 0 0 5px 0;
    color: #000080;
}

.search-panel {
    display: flex;
    gap: 3px;
    margin-bottom: 5px;
    width: 100%;
}

.search-panel input {
    flex: 1;
    min-width: 0;
    padding: 2px;
    border: 1px inset #888;
    background-color: #fff;
    font-size: 10px;
}

.search-panel .small-btn {
    flex-shrink: 0;
}

.contact-list {
    list-style: none;
    flex: 1;
    border: 1px inset #aaa;
    background-color: #fff;
    overflow-y: auto;
    padding: 5px;
    font-size: 11px;
}

/* Make sure the contact list doesn't grow beyond its container */
.contact-list {
    max-height: 100%;
}

.contact-list li {
    padding: 4px 6px;
    margin-bottom: 2px;
    cursor: pointer;
    border: 1px solid #999;
    background-color: #F8F8F8;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.1s;
}

.contact-list li:hover {
    background-color: #316AC5;
    color: #fff;
    border-color: #1E4A8C;
}

.content-area {
    flex: 1;
    padding: 5px;
    display: flex;
    flex-direction: column;
    font-size: 11px;
    overflow: hidden;
    min-width: 0;
}

.content-area h3 {
    font-size: 12px;
    margin: 0 0 5px 0;
    color: #000080;
}

#group-list {
    list-style: none;
    padding: 5px;
    margin: 5px 0 10px 0;
    border: 1px inset #aaa;
    background-color: #fff;
    max-height: 150px;
    overflow-y: auto;
    font-size: 11px;
}

#group-list li {
    padding: 4px;
    cursor: pointer;
    border-bottom: 1px solid #E0E0E0;
}

#group-list li:hover {
    background-color: #316AC5;
    color: #fff;
}

#group-list li:last-child {
    border-bottom: none;
}

.random-users {
    margin-top: 10px;
    border: 1px inset #999;
    background-color: #eee;
    padding: 5px;
}

#random-users-list {
    list-style: none;
    margin-top: 5px;
}

#random-users-list li {
    margin-bottom: 5px;
    border: 1px solid #999;
    background-color: #fff;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/******************************
 * Chat Window
 ******************************/
.chat-window {
    width: 300px;
    height: 300px;
}

.chat-body {
    display: flex;
    flex-direction: column;
    height: calc(100% - 20px);
}

.messages {
    flex: 1;
    margin-bottom: 5px;
    border: 1px inset #999;
    background-color: #fff;
    overflow-y: auto;
    padding: 5px;
    font-size: 11px;
}

.messages .message {
    margin: 5px 0;
}

.chat-input {
    width: 100%;
    height: 50px;
    resize: none;
    border: 1px inset #999;
    margin-bottom: 5px;
    background-color: #fff;
    padding: 5px;
    font-size: 11px;
}

/******************************
 * Context Menu
 ******************************/
.context-menu {
    position: absolute;
    width: 150px;
    border: 1px solid #000;
    background-color: #C0C0C0;
    z-index: 9999;
}

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

.context-menu li {
    display: flex;
    align-items: center;
    padding: 3px 5px;
    font-size: 11px;
    cursor: pointer;
}

.context-menu li:hover {
    background-color: #999;
}

.context-icon {
    width: 16px;
    height: 16px;
    margin-right: 5px;
}

/******************************
 * Windows 95 Taskbar
 ******************************/
.taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 28px;
    background-color: #C0C0C0;
    border-top: 2px solid #000;
    display: flex;
    align-items: center;
}

.start-button {
    width: 70px;
    border-right: 2px solid #000;
    height: 100%;
    background-color: #C0C0C0;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    border: 1px outset #C0C0C0;
}

.start-button:hover {
    background-color: #D0D0D0;
}

.start-button:active {
    border: 1px inset #C0C0C0;
}

.start-logo {
    font-size: 14px;
}

.taskbar-apps {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 2px;
    overflow-x: auto;
    gap: 2px;
}

.taskbar-app-button {
    border: 1px outset #fff;
    background-color: #C0C0C0;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    margin-right: 2px;
    white-space: nowrap;
}

.taskbar-app-button:hover {
    background-color: #eee;
}

.taskbar-clock {
    width: 50px;
    text-align: center;
    border-left: 2px solid #000;
    font-size: 11px;
}

/* Start Menu */
.start-menu {
    position: absolute;
    bottom: 30px;
    left: 2px;
    width: 180px;
    background-color: #C0C0C0;
    border: 2px solid #000;
    box-shadow: 3px 3px 0px #666;
    z-index: 10000;
}

.start-menu-item {
    padding: 6px 12px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #808080;
}

.start-menu-item:hover {
    background-color: #000080;
    color: #fff;
}

.start-menu-separator {
    height: 2px;
    background-color: #808080;
    margin: 2px 0;
}

/******************************
 * Typing Indicator
 ******************************/
.typing-indicator {
    color: #666;
    font-style: italic;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/******************************
 * Message Popup Window
 ******************************/
.message-popup {
    width: 280px;
    height: auto;
    z-index: 9999;
}

.message-popup-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.popup-header {
    border-bottom: 1px solid #999;
    padding-bottom: 5px;
}

.popup-sender-number {
    color: #666;
    font-size: 10px;
}

.popup-message-text {
    background: #fff;
    border: 1px inset #999;
    padding: 8px;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
    font-size: 11px;
}

.popup-actions {
    display: flex;
    gap: 5px;
    justify-content: flex-end;
}

/******************************
 * User Info Window
 ******************************/
.user-info-window {
    width: 320px;
}

.user-info-body {
    padding: 15px;
}

.info-user-name {
    text-align: center;
    border-bottom: 2px solid #000080;
    padding-bottom: 8px;
    margin-bottom: 10px;
    color: #000080;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-bottom: 15px;
}

.info-table td {
    padding: 4px;
    border-bottom: 1px solid #ddd;
}

.info-table td:first-child {
    width: 40%;
}

.info-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}

/******************************
 * Flower Status Icons
 ******************************/
.status-flower {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    position: relative;
    margin-right: 5px;
}

.status-flower.online {
    background: radial-gradient(circle, #90EE90 0%, #32CD32 100%);
    box-shadow: 0 0 4px #32CD32;
}

.status-flower.offline {
    background: radial-gradient(circle, #D3D3D3 0%, #808080 100%);
}

.status-flower.away {
    background: radial-gradient(circle, #FFD700 0%, #FFA500 100%);
    box-shadow: 0 0 4px #FFA500;
}

.status-flower.dnd {
    background: radial-gradient(circle, #FF6B6B 0%, #DC143C 100%);
    box-shadow: 0 0 4px #DC143C;
}

.status-flower.invisible {
    background: radial-gradient(circle, #E0E0E0 0%, #BDBDBD 100%);
    opacity: 0.6;
}

.status-flower.freeforchat {
    background: radial-gradient(circle, #87CEEB 0%, #4169E1 100%);
    box-shadow: 0 0 4px #4169E1;
}

/* ICQ Flower in Title Bar */
.title-bar-text .icq-status-flower {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
    cursor: pointer;
    transition: filter 0.3s ease;
}

/* Status variations using CSS filters for title bar flower */
.title-bar-text .icq-status-flower.online {
    filter: brightness(1) saturate(1);
}

.title-bar-text .icq-status-flower.away {
    filter: hue-rotate(180deg) saturate(1.2);
}

.title-bar-text .icq-status-flower.dnd {
    filter: hue-rotate(270deg) saturate(1.5);
}

.title-bar-text .icq-status-flower.offline {
    filter: grayscale(1) brightness(0.7);
}

.title-bar-text .icq-status-flower.invisible {
    filter: grayscale(1) brightness(0.9);
    opacity: 0.6;
}

/* Remove old flower header from contact list */
.icq-flower-header {
    display: none;
}

/* Contact Groups */
/* Logging In screen: vertical stack of animations */
.icq-loading-flower {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
    margin: 15px auto 10px auto;
}

#logging-in-screen .icq-loading-animation {
    width: 48px;
    height: 48px;
    display: block;
    margin: 5px auto 15px auto;
}
.group-header {
    background: linear-gradient(to bottom, #E0E0E0, #C0C0C0);
    border: 1px solid #808080;
    padding: 3px 6px;
    margin: 2px 0;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    user-select: none;
}

.group-header:hover {
    background: linear-gradient(to bottom, #F0F0F0, #D0D0D0);
}

.group-header .expand-icon {
    display: inline-block;
    width: 12px;
    font-size: 10px;
    color: #000080;
}

/* Enhanced Context Menu Styling */
.context-menu ul li {
    position: relative;
    padding: 4px 8px 4px 24px;
    font-size: 11px;
}

.context-menu .menu-icon {
    position: absolute;
    left: 4px;
    top: 3px;
    font-size: 10px;
    width: 16px;
    text-align: center;
}

.context-menu .menu-separator {
    height: 1px;
    background: #808080;
    margin: 2px 4px;
    padding: 0;
    border: none;
}

.context-menu .menu-separator:hover {
    background: #808080;
    color: transparent;
}

/* Sound Settings Window */
#sound-settings .window-body {
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 11px;
}

#sound-settings .setting-group {
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

#sound-settings .setting-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

#sound-settings input[type="range"] {
    flex: 1;
    max-width: 150px;
}

#sound-settings input[type="checkbox"] {
    margin: 0;
}

#sound-settings h3 {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #000080;
}

/* Connection Status */
.connection-status {
    background: #F0F0F0;
    border: 1px inset #C0C0C0;
    padding: 4px 6px;
    margin-bottom: 8px;
    font-size: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.connection-indicator {
    font-size: 8px;
}

.connection-status.disconnected {
    background: #FFE0E0;
}

.connection-status.connecting {
    background: #FFFACD;
}

/******************************
 * Enhanced Context Menu
 ******************************/
.context-menu {
    position: absolute;
    width: 150px;
    border: 1px solid #000;
    background-color: #C0C0C0;
    z-index: 9999;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

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

.context-menu li {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    font-size: 11px;
    cursor: pointer;
    border-bottom: 1px solid #999;
}

.context-menu li:last-child {
    border-bottom: none;
}

.context-menu li:hover {
    background-color: #000080;
    color: #fff;
}

/******************************
 * Dial-Up Connection Screens
 ******************************/
.dialup-body {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(to bottom, #C0C0C0, #D4D0C8);
}

.dialup-icon {
    font-size: 64px;
    margin-bottom: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.dialup-body h2 {
    font-size: 14px;
    margin-bottom: 15px;
    color: #000080;
}

.dialup-info {
    margin-bottom: 20px;
    font-size: 11px;
    color: #333;
}

.dialup-status {
    background: #fff;
    border: 1px inset #888;
    padding: 8px;
    margin-bottom: 20px;
    text-align: left;
    font-size: 11px;
}

.status-text {
    font-weight: bold;
    color: #008000;
}

.dialup-connect-btn {
    width: 120px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: bold;
}

/* Dial-Up Connecting Screen */
.dialup-connecting-body {
    padding: 25px 20px;
    background: linear-gradient(to bottom, #C0C0C0, #D4D0C8);
    text-align: center;
}

.modem-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.modem-icon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.signal-bars {
    display: flex;
    gap: 4px;
    height: 30px;
    align-items: flex-end;
}

.signal-bar {
    width: 8px;
    background: #008000;
    border: 1px solid #006000;
    animation: signal-pulse 1.5s ease-in-out infinite;
}

.bar1 { height: 20%; animation-delay: 0s; }
.bar2 { height: 40%; animation-delay: 0.1s; }
.bar3 { height: 60%; animation-delay: 0.2s; }
.bar4 { height: 80%; animation-delay: 0.3s; }
.bar5 { height: 100%; animation-delay: 0.4s; }

@keyframes signal-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.connection-message {
    font-size: 13px;
    font-weight: bold;
    color: #000080;
    margin-bottom: 15px;
}

.connection-details {
    background: #fff;
    border: 1px inset #888;
    padding: 10px;
    margin-bottom: 15px;
    text-align: left;
    font-size: 11px;
    font-family: 'Courier New', monospace;
}

.detail-line {
    margin: 4px 0;
    color: #000;
}

#connection-stage {
    color: #008000;
    font-weight: bold;
}

.progress-container {
    margin-top: 15px;
}

.progress-bar-container {
    width: 100%;
    height: 20px;
    background: #fff;
    border: 1px inset #888;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #0000AA, #0000FF);
    transition: width 0.1s linear;
}

.progress-text {
    margin-top: 5px;
    font-size: 11px;
    font-weight: bold;
    color: #000080;
}
