/* ====================================================================
   BRUTAL SURFACES - BASE CONTAINER
   Core window container styles, states, and border effects
   ==================================================================== */

/* ====================================================================
   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;
}

/* ====================================================================
   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;
}

/* ====================================================================
   RESPONSIVE ADJUSTMENTS
   ==================================================================== */
@media (max-width: 768px) {
    .brutal-surface {
        min-width: 280px;
        min-height: 200px;
    }
}


/* ====================================================================
   MODAL BACKDROP
   ==================================================================== */
.brutal-surface-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, var(--backdrop-opacity));
    backdrop-filter: blur(4px);
    transition: opacity 300ms ease-out;
    cursor: pointer;
    z-index: inherit; /* Set programmatically */
}

.brutal-surface-backdrop:hover {
    backdrop-filter: blur(6px);
}