/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Only apply fixed positioning to index.html body */
body.index-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #1e1e1e;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
    width: 100vw;
    position: fixed;
}

/* Default body styles for other pages */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #1e1e1e;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

/* Floating Bar */
.floating-bar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    height: 48px;
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background-color: rgba(42, 42, 42, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: auto;
    width: auto;
    gap: 16px;
}

/* Bar Left Section */
.bar-left {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: #4a9eff;
}

.brand-name {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

/* Bar Center Section */
.bar-center {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.bar-center .action-btn-add,
.bar-center .action-btn-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #3a3a3a;
    background-color: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #cccccc;
}

.bar-center .action-btn-add:hover,
.bar-center .action-btn-delete:hover {
    border-color: #ffffff;
    color: #ffffff;
    transform: scale(1.02);
}

.bar-center .action-btn-add:focus,
.bar-center .action-btn-delete:focus {
    outline-offset: 2px;
    border-color: #4a9eff;
}

.bar-center .action-btn-add:active,
.bar-center .action-btn-delete:active {
    border-color: #ffffff;
    color: #ffffff;
    transform: scale(1.04);
}

/* Bar Right Section */
.bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.bar-right .zoom-controls {
    background-color: transparent;
    padding: 0;
    border: none;
    border-radius: 0;
    position: static;
    bottom: auto;
    left: auto;
    box-shadow: none;
}

/* Zoom Controls in Bar */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zoom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #3a3a3a;
    background-color: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #cccccc;
}

.zoom-btn:hover {
    border-color: #ffffff;
    color: #ffffff;
    transform: scale(1.02);
}

.zoom-level {
    font-size: 12px;
    font-weight: 500;
    color: #cccccc;
    min-width: 40px;
    text-align: center;
}

/* Instructions */
.instructions {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instruction-text {
    color: #888888;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
}

.desktop-text {
    display: block;
}

.mobile-text {
    display: none;
}

.mobile-connect-btn,
.mobile-disconnect-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(74, 158, 255, 0.15);
    color: #4a9eff;
    border: 1px solid rgba(74, 158, 255, 0.3);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: all;
    min-height: 32px;
    min-width: 80px;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.mobile-connect-btn:hover,
.mobile-disconnect-btn:hover {
    background: rgba(74, 158, 255, 0.25);
    border-color: rgba(74, 158, 255, 0.5);
}

.mobile-connect-btn.active {
    background: rgba(74, 158, 255, 0.4);
    border-color: #4a9eff;
    color: #ffffff;
}

.mobile-disconnect-btn.active {
    background: rgba(255, 74, 74, 0.4);
    border-color: #ff4a4a;
    color: #ffffff;
}

.mobile-disconnect-btn {
    background: rgba(255, 74, 74, 0.15);
    color: #ff4a4a;
    border: 1px solid rgba(255, 74, 74, 0.3);
}

.mobile-disconnect-btn:hover {
    background: rgba(255, 74, 74, 0.25);
    border-color: rgba(255, 74, 74, 0.5);
}

.mobile-connection-btn {
    display: none;
    align-items: center;
    gap: 4px;
    background: rgba(74, 158, 255, 0.15);
    color: #4a9eff;
    border: 1px solid rgba(74, 158, 255, 0.3);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: all;
}

.mobile-connection-btn.active {
    background: rgba(74, 158, 255, 0.4);
    border-color: #4a9eff;
    color: #ffffff;
}

.mobile-connection-buttons {
    display: none;
    align-items: center;
    gap: 6px;
}

/* Action button menu */
.action-btn-menu {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #3a3a3a;
    background-color: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #cccccc;
}

.action-btn-menu:hover {
    border-color: #ffffff;
    color: #ffffff;
    transform: scale(1.02);
}

.action-btn-menu:focus {
    outline-offset: 2px;
    border-color: #4a9eff;
}

.action-btn-menu:active {
    border-color: #ffffff;
    color: #ffffff;
    transform: scale(1.04);
}

/* Main Content Area */
.main-content {
    height: 100vh;
    position: relative;
}

.canvas-area {
    width: 100%;
    height: 100%;
    background-color: #1e1e1e;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.canvas-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, #2a2a2a 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .floating-bar {
        min-width: auto;
        width: 95%;
        padding: 0 12px;
        gap: 0;
        top: 10px;
        justify-content: space-between;
    }
    
    .bar-left {
        flex: 0 0 auto;
    }
    
    .bar-center {
        gap: 8px;
        flex: 1 1 auto;
        justify-content: center;
        margin: 0 8px;
    }
    
    .bar-right {
        flex: 0 0 auto;
    }
    
    .bar-left .brand-name {
        display: none;
    }
    
    .bar-right .zoom-controls {
        gap: 6px;
    }
    
    .zoom-btn {
        width: 24px;
        height: 24px;
    }
    
    .zoom-level {
        font-size: 10px;
        min-width: 32px;
    }
    
    .instructions {
        top: 60px;
        flex-direction: column;
        gap: 4px;
    }
    
    .desktop-text {
        display: none;
    }
    
    .mobile-text {
        display: block;
    }
    
    .mobile-connection-btn {
        display: none;
    }
    
    .mobile-connection-buttons {
        display: flex;
    }
    
    .mobile-connect-btn,
    .mobile-disconnect-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .mobile-connect-btn::after,
    .mobile-disconnect-btn::after {
        content: '';
        position: absolute;
        top: -10px;
        left: -10px;
        right: -10px;
        bottom: -10px;
    }
    
    .resizable-card {
        width: 140px;
        height: 140px;
        min-width: 120px;
        min-height: 120px;
        max-width: 85vw;
        max-height: 50vh;
    }
    
    .resizable-card .card-header {
        height: 50px;
        padding: 8px;
    }
    
    .resizable-card .card-controls {
        padding: 10px;
        gap: 6px;
    }
    
    .resizable-card .control-dot {
        width: 20px;
        height: 20px;
        min-width: 44px;
        min-height: 44px;
    }
    
    .resizable-card .card-content {
        padding: 15px;
    }
    
    .resizable-card .content-area {
        font-size: 16px;
        padding: 8px;
    }
    
    .resize-handle {
        width: 24px;
        height: 24px;
        min-width: 44px;
        min-height: 44px;
        bottom: 6px;
        right: 6px;
    }
}

@media (max-width: 480px) {
    .floating-bar {
        width: 98%;
        padding: 0 6px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .action-btn-add,
    .action-btn-delete,
    .action-btn-menu {
        width: 28px;
        height: 28px;
    }
    
    .zoom-btn {
        width: 22px;
        height: 22px;
    }
    
    .zoom-level {
        font-size: 9px;
        min-width: 28px;
    }
}

/* Animation and Transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.floating-bar {
    animation: fadeIn 0.3s ease-out;
}

/* Focus States */
.zoom-btn:focus {
    outline-offset: 2px;
    border-color: #4a9eff;
}

.bar-center .action-btn-add:focus,
.bar-center .action-btn-delete:focus,
.action-btn-menu:focus {
    outline-offset: 2px;
    border-color: #4a9eff;
}

/* Disabled States */
.zoom-btn:disabled,
.bar-center .action-btn-add:disabled,
.bar-center .action-btn-delete:disabled,
.action-btn-menu:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #3a3a3a;
    color: #3a3a3a;
}

.zoom-btn:disabled:hover,
.bar-center .action-btn-add:disabled:hover,
.bar-center .action-btn-delete:disabled:hover,
.action-btn-menu:disabled:hover {
    border-color: #3a3a3a;
    color: #3a3a3a;
    transform: none;
}

/* Simple Colored Card */
.resizable-card {
    position: absolute;
    top: 100px;
    left: 100px;
    transform: scale(0.9);
    width: 150px;
    height: 150px;
    min-width: 120px;
    min-height: 120px;
    background: var(--card-primary, #4472a6);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 1500;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: grab;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.resizable-card.selected-for-connection {
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.6);
}

.canvas-area.connection-mode-active {
    background: rgba(74, 158, 255, 0.02);
    border: 2px dashed rgba(74, 158, 255, 0.3);
}

.canvas-area.disconnect-mode-active {
    background: rgba(255, 100, 100, 0.02);
    border: 2px dashed rgba(255, 100, 100, 0.3);
}

.resizable-card.show {
    opacity: 1;
    transform: scale(1);
}

.resizable-card.dragging {
    cursor: grabbing;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
    transform: scale(1.05);
}

.resizable-card.removing {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Card Header */
.resizable-card .card-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
    height: 20px;
    flex-shrink: 0;
    cursor: grab;
    border-radius: 20px 20px 0 0;
}

.resizable-card .card-header:active {
    cursor: grabbing;
}

/* Card Controls */
.resizable-card .card-controls {
    display: flex;
    gap: 4px;
    padding: 8px;
}

.resizable-card .control-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.resizable-card .color-dot {
    background: rgba(255, 255, 255, 0.9);
}

.resizable-card .delete-dot {
    background: rgba(255, 74, 74, 0.9);
}

.resizable-card .control-dot:hover {
    transform: scale(1.2);
    border-color: rgba(255, 255, 255, 0.8);
}

.resizable-card .color-dot:hover {
    background: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.resizable-card .delete-dot:hover {
    background: #ff4a4a;
    box-shadow: 0 0 8px rgba(255, 74, 74, 0.6);
}

/* Card Content */
.resizable-card .card-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.resizable-card .content-area {
    width: 100%;
    height: 100%;
    color: var(--card-text, #ffffff);
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    border: none;
    background: transparent;
    resize: none;
    overflow: hidden;
    word-wrap: break-word;
    white-space: pre-wrap;
    text-align: left;
    font-weight: 500;
    padding: 4px;
}

.resizable-card .content-area:focus {
    color: var(--card-text, #ffffff);
}

.resizable-card .placeholder-text {
    color: var(--card-text, #ffffff);
    opacity: 0.6;
    font-style: italic;
    font-weight: 400;
}

/* Resize Handle */
.resizable-card .resize-handle {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.3) 50%);
    border-radius: 0 0 18px 0;
    z-index: 10;
}

.resizable-card:hover .resize-handle {
    opacity: 1;
}

.resizable-card .resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.5) 50%);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .resizable-card {
        width: 140px;
        height: 140px;
        min-width: 120px;
        min-height: 120px;
        max-width: 85vw;
        max-height: 50vh;
    }
    
    .resizable-card .card-header {
        height: 20px;
        padding: 0;
        justify-content: flex-end;
    }
    
    .resizable-card .card-controls {
        padding: 4px;
        gap: 2px;
        position: static;
        top: auto;
        right: auto;
        z-index: auto;
    }
    
    .resizable-card .control-dot {
        width: 10px;
        height: 10px;
        min-width: 10px;
        min-height: 10px;
    }
    
    .resizable-card .card-content {
        padding: 12px;
        padding-top: 0;
    }
    
    .resizable-card .content-area {
        font-size: 16px;
        padding: 8px;
    }
    
    .resizable-card .resize-handle {
        width: 32px;
        height: 32px;
        bottom: 2px;
        right: 2px;
        opacity: 0.7;
        z-index: 15;
    }
    
.resizable-card .resize-handle:hover {
opacity: 1;
}
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
.resizable-card .control-dot {
width: 20px;
height: 20px;
min-width: 20px;
min-height: 20px;
position: relative;
}
    
.resizable-card .control-dot::after {
content: '';
position: absolute;
top: -8px;
left: -8px;
right: -8px;
bottom: -8px;
}
    
.resizable-card .resize-handle {
width: 40px;
height: 40px;
min-width: 40px;
min-height: 40px;
bottom: 0;
right: 0;
opacity: 0.8;
z-index: 20;
}
    
.resizable-card .resize-handle::after {
content: '';
position: absolute;
top: -10px;
left: -10px;
right: -10px;
bottom: -10px;
}
    
.resizable-card .resize-handle:hover {
opacity: 1;
}
    
.zoom-btn,
.action-btn-add,
.action-btn-delete,
.action-btn-menu {
min-width: 44px;
min-height: 44px;
}
    
.mobile-connection-btn {
min-height: 44px;
padding: 8px 12px;
}
}