/* Hyprland Rice Window Manager */

/* ---- container ---- */

#windows-container {
    position: fixed;
    inset: 0;
    top: calc(var(--bar-height) + 8px);
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

/* ---- window chrome ---- */

.plasma-window {
    pointer-events: auto;
    position: absolute;
    border-radius: var(--radius-window);
    box-shadow: var(--shadow-window);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    transition: box-shadow var(--transition-fast);
    animation: plasmaOpen 0.25s ease-out;
}

/* ---- active state (default) ---- */

.plasma-window:not(.inactive) {
    box-shadow: var(--shadow-window-active);
    border-color: var(--glass-border-active);
}

/* ---- animated gradient border ---- */

.plasma-window:not(.inactive)::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius-window) + 2px);
  background: conic-gradient(from var(--border-angle), var(--gradient-border-colors));
  z-index: -1;
  animation: borderRotate 4s linear infinite;
}

.plasma-window:not(.inactive)::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-window);
  background: var(--bg-surface-solid);
  z-index: -1;
}

@keyframes borderRotate {
  to { --border-angle: 360deg; }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ---- title bar ---- */

.plasma-window .title-bar {
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    background: var(--bg-panel);
    padding: 4px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: default;
    user-select: none;
    flex-shrink: 0;
    border-bottom: 1px solid var(--glass-border);
    min-height: 28px;
}

.plasma-window .title-bar-text {
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- text-symbol controls ---- */

.plasma-window .title-bar-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.plasma-window .title-bar-controls button {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
}

.plasma-window .title-bar-controls .btn-minimize { color: var(--minimize-green); }
.plasma-window .title-bar-controls .btn-maximize { color: var(--maximize-yellow); }
.plasma-window .title-bar-controls .btn-close { color: var(--close-red); }

.plasma-window .title-bar-controls button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

/* ---- inactive state ---- */

.plasma-window.inactive {
    box-shadow: var(--shadow-window);
    opacity: 0.85;
}

.plasma-window.inactive .title-bar {
    background: rgba(15, 15, 30, 0.6);
}

.plasma-window.inactive .title-bar-text {
    color: var(--text-secondary);
}

/* ---- window body ---- */

.plasma-window .window-body {
    flex: 1;
    overflow: auto;
    min-height: 0;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 13px;
}

/* ---- resize handle ---- */

.plasma-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 14px;
    height: 14px;
    cursor: nwse-resize;
    z-index: 1;
    opacity: 0.3;
    background:
        radial-gradient(circle, var(--text-secondary) 1px, transparent 1px) 8px 8px / 4px 4px no-repeat,
        radial-gradient(circle, var(--text-secondary) 1px, transparent 1px) 4px 12px / 4px 4px no-repeat,
        radial-gradient(circle, var(--text-secondary) 1px, transparent 1px) 12px 4px / 4px 4px no-repeat;
}

.plasma-window.maximized .plasma-resize-handle {
    display: none;
}

/* ---- drag overlay ---- */

.plasma-drag-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    cursor: move;
}

/* ---- maximized state ---- */

.plasma-window.maximized {
    top: calc(var(--bar-height) + 8px) !important;
    left: 0 !important;
    width: 100vw !important;
    height: calc(100vh - var(--bar-height) - 8px) !important;
    border-radius: 0;
    box-shadow: none;
}

.plasma-window.maximized::before,
.plasma-window.maximized::after {
    display: none;
}

/* ---- open animation ---- */

@keyframes plasmaOpen {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ---- scrollbar (thin, dark) ---- */

.plasma-window .window-body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.plasma-window .window-body::-webkit-scrollbar-track {
    background: #1a1a32;
    border-radius: 4px;
}

.plasma-window .window-body::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

.plasma-window .window-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

.plasma-window .window-body {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) #1a1a32;
}

/* ---- selection color ---- */

.plasma-window .window-body ::selection {
    background: var(--accent);
    color: #fff;
}

/* ---- mobile ---- */

@media (max-width: 640px) {
    .plasma-window {
        min-width: 200px;
        max-width: 100vw;
    }
}

/* ── Workspace offscreen ── */
.plasma-window.ws-offscreen { display: none !important; }
