/* ====================================================================
   BRUTAL SURFACES - Minimalist Window Manager CSS
   Uses IO Design System - Replace entire brutal-surface CSS with this
   ==================================================================== */

/* ====================================================================
   BASE WINDOW CONTAINER
   ==================================================================== */
.brutal-surface {
    position: fixed;
    background: var(--io-surface-raised);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow var(--io-transition-base);
    border: 1px solid var(--io-border-subtle);
}

/* Bottom incomplete fade border */
.brutal-surface::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(var(--io-border-fade-base), 0.3) 15%,
        rgba(var(--io-border-fade-base), 0.8) 50%,
        rgba(var(--io-border-fade-base), 0.3) 85%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* ====================================================================
   FOCUSED STATE - Add subtle glow to entire window
   ==================================================================== */
.brutal-surface-focused {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
              
}

/* Make the bottom border glow when focused */
.brutal-surface-focused::before {
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(var(--io-border-fade-base), 0.4) 15%,
        var(--io-accent) 50%,
        rgba(var(--io-border-fade-base), 0.4) 85%,
        transparent 100%
    );
    box-shadow: 0 0 8px var(--io-accent-glow);
}
/* ====================================================================
   DRAGGING STATE
   ==================================================================== */
.brutal-surface-dragging {
    cursor: move !important;
    user-select: none;
}

body.dragging-active,
body.dragging-active * {
    cursor: grabbing !important;
    user-select: none !important;
}

/* ====================================================================
   MAXIMIZED STATE
   ==================================================================== */
.brutal-surface-maximized {
    border-radius: 0 !important;
}

/* ====================================================================
   HEADER
   ==================================================================== */
.brutal-surface-header {
    background: var(--io-surface-sunken);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--io-space-md);
    cursor: move;
    min-height: 40px;
    user-select: none;
    padding: 0 var(--io-space-sm) 0 var(--io-space-sm);
    position: relative;
    flex-shrink: 0;
}

/* Bottom incomplete fade border on header */
.brutal-surface-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 15%;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(var(--io-border-fade-base), 0.3) 15%,
        rgba(var(--io-border-fade-base), 0.8) 50%,
        rgba(var(--io-border-fade-base), 0.3) 85%,
        transparent 100%
    );
    pointer-events: none;
}

/* ====================================================================
   MENU
   ==================================================================== */
.brutal-surface-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.brutal-surface-menu-btn {
    background: transparent;
    border: none;
    color: var(--io-text-tertiary);
    cursor: pointer;
    padding: 6px 8px;
    font-size: 12px;
    transition: all var(--io-transition-fast);
    opacity: 0.6;
}

.brutal-surface-menu-btn:hover {
    color: var(--io-accent);
    opacity: 1;
}

/* ====================================================================
   DROPDOWN MENU
   ==================================================================== */
.brutal-surface-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--io-surface-raised);
    border: 1px solid var(--io-border);
    min-width: 200px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all var(--io-transition-base);
    z-index: 100;
}

.brutal-surface-dropdown.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.brutal-surface-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--io-space-sm);
    padding: 10px var(--io-space-md);
    color: var(--io-text-secondary);
    cursor: pointer;
    transition: all var(--io-transition-fast);
    border-bottom: 1px solid var(--io-border-subtle);
    font-size: var(--io-text-sm);
}

.brutal-surface-dropdown-item:last-child {
    border-bottom: none;
}

.brutal-surface-dropdown-item:hover {
    background: var(--io-surface-hover);
    color: var(--io-text-primary);
}

.brutal-surface-dropdown-item i {
    color: var(--io-accent);
    width: 14px;
    font-size: 11px;
    text-align: center;
    opacity: 0.7;
}

/* ====================================================================
   TITLE
   ==================================================================== */
.brutal-surface-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--io-space-sm);
    color: var(--io-text-secondary);
    font-size: var(--io-text-sm);
    text-align: center;
    letter-spacing: 0.02em;
}

.brutal-surface-title i {
    color: var(--io-accent);
    font-size: 11px;
    opacity: 0.7;
}

.brutal-surface-title span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

/* ====================================================================
   CONTROLS
   ==================================================================== */
.brutal-surface-controls {
    display: flex;
    gap: var(--io-space-xs);
    justify-content: flex-end;
}

.brutal-surface-btn {
    background: transparent;
    border: none;
    color: var(--io-text-tertiary);
    cursor: pointer;
    padding: 6px 8px;
    transition: all var(--io-transition-fast);
    font-size: 11px;
    line-height: 1;
    opacity: 0.6;
}

.brutal-surface-btn:hover {
    color: var(--io-text-primary);
    opacity: 1;
}

.brutal-surface-btn-close:hover {
    color: var(--io-accent);
    opacity: 1;
}

/* ====================================================================
   BODY
   ==================================================================== */
.brutal-surface-body {
    flex: 1;
    overflow: auto;
    background: var(--io-surface-base);
    scrollbar-width: thin;
    scrollbar-color: var(--io-accent-subtle) var(--io-surface-base);
}

.brutal-surface-body-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--io-accent-subtle) var(--io-surface-base);
}

/* Webkit scrollbar styling */
.brutal-surface-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.brutal-surface-body::-webkit-scrollbar-track {
    background: transparent;
}

.brutal-surface-body::-webkit-scrollbar-thumb {
    background: var(--io-accent-subtle);
    border-radius: 3px;
}

.brutal-surface-body::-webkit-scrollbar-thumb:hover {
    background: var(--io-accent);
}

/* ====================================================================
   HEADERLESS MODE - Drag Grip
   ==================================================================== */
.brutal-surface-drag-grip {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: move;
    color: var(--io-text-tertiary);
    z-index: 100;
    transition: all var(--io-transition-base);
    opacity: 0.4;
    font-size: 10px;
}

.brutal-surface-drag-grip:hover {
    opacity: 1;
    color: var(--io-accent);
}

/* ====================================================================
   HEADERLESS MODE - Close Button
   ==================================================================== */
.brutal-surface-headerless-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: var(--io-surface-raised);
    border: 1px solid var(--io-border);
    color: var(--io-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--io-transition-base);
    z-index: 100;
    font-size: 11px;
    opacity: 0.6;
}

.brutal-surface-headerless-close:hover {
    background: var(--io-accent);
    color: var(--io-on-accent);
    border-color: var(--io-accent);
    opacity: 1;
}











/* ============================================= */
/* ANIMATIONS */
/* ============================================= */

/* FADE ANIMATIONS */
@keyframes brutal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes brutal-fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.brutal-surface-fade-in {
    animation: brutal-fade-in 300ms ease-out;
}

.brutal-surface-fade-out {
    animation: brutal-fade-out 300ms ease-out;
}

/* BOUNCE ANIMATIONS */
@keyframes brutal-bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-100px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateY(0);
    }
    70% {
        transform: scale(0.9) translateY(-10px);
    }
    100% {
        transform: scale(1) translateY(0);
    }
}

@keyframes brutal-bounce-out {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    30% {
        transform: scale(1.1) translateY(-20px);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) translateY(100px);
    }
}

.brutal-surface-bounce-in {
    animation: brutal-bounce-in 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.brutal-surface-bounce-out {
    animation: brutal-bounce-out 500ms ease-in;
}

/* SLIDE UP ANIMATIONS */
@keyframes brutal-slide-up-in {
    from {
        opacity: 0;
        transform: translateY(100vh);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes brutal-slide-up-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100vh);
    }
}

.brutal-surface-slide-up-in {
    animation: brutal-slide-up-in 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.brutal-surface-slide-up-out {
    animation: brutal-slide-up-out 400ms ease-in;
}

/* SLIDE DOWN ANIMATIONS */
@keyframes brutal-slide-down-in {
    from {
        opacity: 0;
        transform: translateY(-100vh);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes brutal-slide-down-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(100vh);
    }
}

.brutal-surface-slide-down-in {
    animation: brutal-slide-down-in 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.brutal-surface-slide-down-out {
    animation: brutal-slide-down-out 400ms ease-in;
}

/* SLIDE LEFT ANIMATIONS */
@keyframes brutal-slide-left-in {
    from {
        opacity: 0;
        transform: translateX(100vw);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes brutal-slide-left-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-100vw);
    }
}

.brutal-surface-slide-left-in {
    animation: brutal-slide-left-in 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.brutal-surface-slide-left-out {
    animation: brutal-slide-left-out 400ms ease-in;
}

/* SLIDE RIGHT ANIMATIONS */
@keyframes brutal-slide-right-in {
    from {
        opacity: 0;
        transform: translateX(-100vw);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes brutal-slide-right-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100vw);
    }
}

.brutal-surface-slide-right-in {
    animation: brutal-slide-right-in 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.brutal-surface-slide-right-out {
    animation: brutal-slide-right-out 400ms ease-in;
}

/* SCALE ANIMATIONS */
@keyframes brutal-scale-in {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes brutal-scale-out {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0);
    }
}

.brutal-surface-scale-in {
    animation: brutal-scale-in 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brutal-surface-scale-out {
    animation: brutal-scale-out 350ms ease-in;
}

/* FLIP ANIMATIONS */
@keyframes brutal-flip-in {
    from {
        opacity: 0;
        transform: perspective(400px) rotateY(90deg);
    }
    to {
        opacity: 1;
        transform: perspective(400px) rotateY(0deg);
    }
}

@keyframes brutal-flip-out {
    from {
        opacity: 1;
        transform: perspective(400px) rotateY(0deg);
    }
    to {
        opacity: 0;
        transform: perspective(400px) rotateY(-90deg);
    }
}

.brutal-surface-flip-in {
    animation: brutal-flip-in 600ms ease-out;
    transform-style: preserve-3d;
}

.brutal-surface-flip-out {
    animation: brutal-flip-out 600ms ease-in;
    transform-style: preserve-3d;
}

/* GLITCH ANIMATIONS */
@keyframes brutal-glitch-in {
    0% {
        opacity: 0;
        transform: translateX(-100px) skewX(-30deg);
        filter: hue-rotate(0deg);
    }
    20% {
        transform: translateX(100px) skewX(30deg);
        filter: hue-rotate(90deg);
    }
    40% {
        transform: translateX(-50px) skewX(-15deg);
        filter: hue-rotate(180deg);
    }
    60% {
        transform: translateX(50px) skewX(15deg);
        filter: hue-rotate(270deg);
    }
    80% {
        transform: translateX(-10px) skewX(-5deg);
        filter: hue-rotate(360deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) skewX(0deg);
        filter: hue-rotate(0deg);
    }
}

@keyframes brutal-glitch-out {
    0% {
        opacity: 1;
        transform: translateX(0) skewX(0deg);
        filter: hue-rotate(0deg);
    }
    20% {
        transform: translateX(10px) skewX(5deg);
        filter: hue-rotate(90deg);
    }
    40% {
        transform: translateX(-50px) skewX(15deg);
        filter: hue-rotate(180deg);
    }
    60% {
        transform: translateX(100px) skewX(-30deg);
        filter: hue-rotate(270deg);
    }
    80% {
        transform: translateX(-100px) skewX(30deg);
        filter: hue-rotate(360deg);
    }
    100% {
        opacity: 0;
        transform: translateX(100px) skewX(-30deg);
        filter: hue-rotate(0deg);
    }
}

.brutal-surface-glitch-in {
    animation: brutal-glitch-in 800ms ease-out;
}

.brutal-surface-glitch-out {
    animation: brutal-glitch-out 800ms ease-in;
}

/* MATRIX ANIMATIONS */
@keyframes brutal-matrix-in {
    0% {
        opacity: 0;
        transform: translateY(-100vh) scaleY(0.1);
        filter: blur(10px) hue-rotate(0deg);
    }
    50% {
        opacity: 0.5;
        filter: blur(5px) hue-rotate(180deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scaleY(1);
        filter: blur(0px) hue-rotate(360deg);
    }
}

@keyframes brutal-matrix-out {
    0% {
        opacity: 1;
        transform: translateY(0) scaleY(1);
        filter: blur(0px) hue-rotate(0deg);
    }
    50% {
        opacity: 0.5;
        filter: blur(5px) hue-rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) scaleY(0.1);
        filter: blur(10px) hue-rotate(360deg);
    }
}

.brutal-surface-matrix-in {
    animation: brutal-matrix-in 1000ms ease-out;
}

.brutal-surface-matrix-out {
    animation: brutal-matrix-out 1000ms ease-in;
}

/* ZOOM ANIMATIONS */
@keyframes brutal-zoom-in {
    from {
        opacity: 0;
        transform: scale(0) rotate(180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes brutal-zoom-out {
    from {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    to {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
}

.brutal-surface-zoom-in {
    animation: brutal-zoom-in 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brutal-surface-zoom-out {
    animation: brutal-zoom-out 300ms ease-in;
}

/* ROTATE ANIMATIONS */
@keyframes brutal-rotate-in {
    from {
        opacity: 0;
        transform: rotate(-720deg) scale(0);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

@keyframes brutal-rotate-out {
    from {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
    to {
        opacity: 0;
        transform: rotate(720deg) scale(0);
    }
}

.brutal-surface-rotate-in {
    animation: brutal-rotate-in 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brutal-surface-rotate-out {
    animation: brutal-rotate-out 500ms ease-in;
}

/* Global dragging state */
body.dragging-active {
    cursor: grabbing !important;
    user-select: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .brutal-surface {
        min-width: 280px;
        min-height: 200px;
    }
    
    .brutal-surface-header {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .brutal-surface-body {
        padding: 15px;
    }
}