/* Terminal Overlay */
.terminal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.terminal-overlay.open {
    display: flex !important;
}

.terminal-overlay.closing {
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    background: rgba(0, 0, 0, 0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Terminal Window */
.terminal-window {
    width: 1200px;
    max-width: none;
    height: 700px;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 10px;
    box-shadow: 
        0 25px 60px rgba(0, 0, 0, 0.4),
        0 10px 25px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform, opacity;
    position: relative;
}

.terminal-window.active {
    box-shadow: 
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 10px 30px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.terminal-window.inactive {
    opacity: 0.85;
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.3),
        0 5px 15px rgba(0, 0, 0, 0.2);
}

.terminal-window.inactive .title-bar {
    background: rgba(45, 45, 45, 0.8);
}

.terminal-window.inactive .traffic-light {
    opacity: 0.5;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.terminal-window.closing {
    animation: closeWindow 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes closeWindow {
    0% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0px);
    }
    100% {
        opacity: 0;
        transform: scale(0.92);
        filter: blur(0px);
    }
}

.terminal-window.minimized {
    animation: minimizeWindow 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    pointer-events: none;
}

@keyframes minimizeWindow {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.92);
    }
}

.terminal-window.maximized {
    width: 98vw;
    height: 95vh;
    max-width: none;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.terminal-window.dragging {
    transition: none !important;
    cursor: grabbing;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    z-index: 1000;
}

.resize-handle.top {
    top: 0;
    left: 10px;
    right: 10px;
    height: 8px;
    cursor: ns-resize;
}

.resize-handle.bottom {
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 8px;
    cursor: ns-resize;
}

.resize-handle.left {
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 8px;
    cursor: ew-resize;
}

.resize-handle.right {
    right: 0;
    top: 10px;
    bottom: 10px;
    width: 8px;
    cursor: ew-resize;
}

.resize-handle.top-left {
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
}

.resize-handle.top-right {
    top: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nesw-resize;
}

.resize-handle.bottom-left {
    bottom: 0;
    left: 0;
    width: 16px;
    height: 16px;
    cursor: nesw-resize;
}

.resize-handle.bottom-right {
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
}

.terminal-window.resizing {
    transition: none !important;
    user-select: none;
}

/* Title Bar */
.terminal-window .title-bar {
    height: 28px;
    background: linear-gradient(
        to bottom,
        rgba(60, 60, 60, 0.95) 0%,
        rgba(45, 45, 45, 0.95) 100%
    );
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: grab;
    user-select: none;
    transition: background 0.15s ease, backdrop-filter 0.15s ease;
}

.terminal-window .title-bar:active {
    cursor: grabbing;
}

.terminal-window .title-bar:hover {
    background: linear-gradient(
        to bottom,
        rgba(65, 65, 65, 0.95) 0%,
        rgba(50, 50, 50, 0.95) 100%
    );
}

/* Traffic Lights */
.terminal-window .traffic-lights {
    position: absolute;
    left: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.terminal-window .traffic-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    position: relative;
    transition: all 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.4);
}

.terminal-window .traffic-light:hover {
    filter: brightness(1.15);
    transform: scale(1.05);
}

.terminal-window .traffic-light:active {
    transform: scale(0.92);
    filter: brightness(0.95);
    transition: all 0.08s cubic-bezier(0.4, 0.0, 1, 1);
}

.terminal-window .traffic-light.close {
    background: linear-gradient(135deg, #ff6057 0%, #ff5f57 100%);
}

.terminal-window .traffic-light.minimize {
    background: linear-gradient(135deg, #ffbd2e 0%, #ffbe30 100%);
}

.terminal-window .traffic-light.maximize {
    background: linear-gradient(135deg, #28ca42 0%, #29c941 100%);
}

/* Show icons on hover */
.terminal-window .title-bar:hover .traffic-light.close::before {
    content: '×';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(0, 0, 0, 0.7);
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    opacity: 0;
    animation: fadeInIcon 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.terminal-window .title-bar:hover .traffic-light.minimize::before {
    content: '−';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(0, 0, 0, 0.7);
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    opacity: 0;
    animation: fadeInIcon 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.terminal-window .title-bar:hover .traffic-light.maximize::before {
    content: '⤢';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    color: rgba(0, 0, 0, 0.7);
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
    opacity: 0;
    animation: fadeInIcon 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeInIcon {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Window Title */
.terminal-window .window-title {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* Terminal Content */
.terminal-window .terminal-content {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    background: #000000;
}

.terminal-window .terminal-content::-webkit-scrollbar {
    width: 8px;
}

.terminal-window .terminal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.terminal-window .terminal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.terminal-window .terminal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Terminal Output */
.terminal-window .terminal-output {
    margin-bottom: 8px;
}

.terminal-window .line {
    margin: 2px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.terminal-window .line.prompt {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

/* Input Line */
.terminal-window .input-line {
    display: flex;
    gap: 4px;
    align-items: center;
    position: relative;
}

.terminal-window .user {
    color: #31d158;
    font-weight: 600;
}

.terminal-window .path {
    color: #0a84ff;
    font-weight: 600;
}

.terminal-window .symbol {
    color: rgba(255, 255, 255, 0.9);
    margin-right: 4px;
}

/* Terminal Input */
.terminal-window .terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    padding: 0;
    caret-color: rgba(255, 255, 255, 0.9);
}

/* Cursor */
.terminal-window .cursor {
    display: none;
}

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

/* Command colors */
.terminal-window .command {
    color: #ff9f0a;
}

.terminal-window .output {
    color: rgba(255, 255, 255, 0.85);
}

.terminal-window .error {
    color: #ff453a;
}

.terminal-window .success {
    color: #32d74b;
}

/* Responsive */
@media (max-width: 768px) {
    .terminal-window {
        width: 95%;
        height: 80vh;
    }

    .terminal-window .terminal-content {
        font-size: 12px;
        padding: 12px 16px;
    }
}
