/* Custom Title Bar Styles */
.custom-titlebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: linear-gradient(135deg, rgba(18, 10, 31, 0.98) 0%, rgba(30, 15, 50, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10000;
    border-bottom: 1px solid rgba(138, 43, 226, 0.2);
    box-shadow: 0 2px 10px rgba(138, 43, 226, 0.1);
    user-select: none;
    -webkit-user-select: none;
    -webkit-app-region: drag;
}

.titlebar-drag-region {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 12px;
    flex: 1;
    height: 100%;
}

.titlebar-icon {
    font-size: 14px;
    color: #8a2be2;
    text-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

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

.titlebar-title {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #e0d0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.titlebar-controls {
    display: flex;
    height: 100%;
    -webkit-app-region: no-drag;
}

.titlebar-button {
    width: 46px;
    height: 100%;
    border: none;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.titlebar-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(138, 43, 226, 0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.titlebar-button:hover::before {
    opacity: 1;
}

.titlebar-button:hover {
    color: #ffffff;
}

.titlebar-button:active {
    transform: scale(0.95);
}

.titlebar-button svg {
    width: 12px;
    height: 12px;
    position: relative;
    z-index: 1;
}

.titlebar-button svg rect,
.titlebar-button svg path {
    fill: currentColor;
    stroke: currentColor;
}

.titlebar-button.close:hover {
    background: #e81123;
    color: #ffffff;
}

.titlebar-button.close:hover::before {
    opacity: 0;
}

.titlebar-button.minimize:hover {
    background: rgba(138, 43, 226, 0.3);
}

.titlebar-button.maximize:hover {
    background: rgba(138, 43, 226, 0.3);
}

/* Adjust main content to account for title bar */
body {
    padding-top: 32px;
}

.intro-container {
    top: 32px;
    height: calc(100vh - 32px);
}

.main-content {
    margin-top: 32px;
}

.navbar {
    top: 32px;
    height: calc(100vh - 32px);
}

/* macOS specific - show custom titlebar on mac too */
body.platform-darwin .custom-titlebar {
    display: flex;
}

body.platform-darwin {
    padding-top: 32px;
}

body.platform-darwin .intro-container {
    top: 32px;
    height: calc(100vh - 32px);
}

body.platform-darwin .main-content {
    margin-top: 32px;
}

/* Maximize state icon change - show restore icon when maximized */
.custom-titlebar.maximized .titlebar-button.maximize svg {
    /* When maximized, show a "restore down" icon (smaller overlapping squares) */
}

.custom-titlebar.maximized .titlebar-button.maximize svg rect {
    x: 2.5;
    y: 2.5;
    width: 7;
    height: 7;
}

.custom-titlebar.maximized .titlebar-button.maximize svg line:nth-of-type(1) {
    x1: 0.5;
    y1: 0.5;
    x2: 9.5;
    y2: 0.5;
}

.custom-titlebar.maximized .titlebar-button.maximize svg line:nth-of-type(2) {
    x1: 9.5;
    y1: 0.5;
    x2: 9.5;
    y2: 9.5;
}

.custom-titlebar.maximized .titlebar-button.maximize svg line:nth-of-type(3) {
    x1: 9.5;
    y1: 9.5;
    x2: 0.5;
    y2: 9.5;
}
