@import './DesignTokens.css';

/* IMPORTANT: Override any conflicting styles from other CSS files */
.swarm-design-container {
    min-height: 100vh !important;
    background: var(--color-bg-primary) !important;
    color: var(--color-text-primary) !important;
    padding: var(--spacing-lg) !important;
    font-family: var(--font-family-primary) !important;
    /* Reset any flexbox properties that might be interfering */
    display: block !important;
    justify-content: initial !important;
    align-items: initial !important;
    /* Ensure proper layout flow */
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Clean Full-Width Button Bar at Top */
.swarm-design-container .top-button-bar {
    display: flex !important;
    gap: var(--spacing-base);
    width: 100%;
    background: var(--color-bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-base);
    border: 1px solid var(--color-border-primary);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
}

.swarm-design-container .top-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-base) var(--spacing-lg);
    border: none;
    border-radius: var(--border-radius-base);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family-primary);
    cursor: pointer;
    transition: var(--transition-all);
    color: var(--color-text-primary);
    text-decoration: none;
    min-height: 48px;
    box-sizing: border-box;
}

.swarm-design-container .top-btn.update {
    background: var(--color-info);
}

.swarm-design-container .top-btn.update:hover {
    background: var(--color-info-hover);
}

.swarm-design-container .top-btn.commit {
    background: var(--color-success);
}

.swarm-design-container .top-btn.commit:hover {
    background: var(--color-success-hover);
}

.swarm-design-container .top-btn.import {
    background: var(--color-warning);
}

.swarm-design-container .top-btn.import:hover {
    background: var(--color-warning-hover);
}

.swarm-design-container .top-btn.import input[type="file"] {
    display: none;
}

.swarm-design-container .top-btn.export {
    background: var(--color-primary);
}

.swarm-design-container .top-btn.export:hover {
    background: var(--color-primary-hover);
}

.swarm-design-container .top-btn.revert {
    background: var(--color-danger);
}

.swarm-design-container .top-btn.revert:hover {
    background: var(--color-danger-hover);
}

.swarm-design-container .top-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.swarm-design-container .top-btn svg {
    font-size: var(--font-size-lg);
}

/* Two-Column Layout - Force proper grid */
.swarm-design-container .two-column-layout {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: var(--spacing-xl) !important;
    margin-bottom: var(--spacing-xl) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Left Column: Drone List */
.swarm-design-container .left-column {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-primary);
    border-radius: var(--border-radius-base);
    padding: var(--spacing-lg);
    box-sizing: border-box;
    width: 100%;
}

.swarm-design-container .left-column h3 {
    margin: 0 0 var(--spacing-lg) 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-primary);
    padding-bottom: var(--spacing-base);
}

.swarm-design-container .drone-list {
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) var(--color-bg-tertiary);
}

.swarm-design-container .drone-list::-webkit-scrollbar {
    width: 8px;
}

.swarm-design-container .drone-list::-webkit-scrollbar-track {
    background: var(--color-bg-tertiary);
}

.swarm-design-container .drone-list::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: var(--border-radius-base);
}

/* Right Column: Graph View */
.swarm-design-container .right-column {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-primary);
    border-radius: var(--border-radius-base);
    padding: var(--spacing-lg);
    box-sizing: border-box;
    width: 100%;
}

.swarm-design-container .right-column h3 {
    margin: 0 0 var(--spacing-lg) 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-primary);
    padding-bottom: var(--spacing-base);
}

.swarm-design-container .graph-view {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-primary);
    border-radius: var(--border-radius-base);
    padding: var(--spacing-base);
    min-height: 500px;
    width: 100%;
    box-sizing: border-box;
}

/* Bottom Section: Plots */
.swarm-design-container .plots-section {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-primary);
    border-radius: var(--border-radius-base);
    padding: var(--spacing-lg);
    width: 100%;
    box-sizing: border-box;
}

.swarm-design-container .plots-section h3 {
    margin: 0 0 var(--spacing-lg) 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-primary);
    padding-bottom: var(--spacing-base);
}

/* Empty State */
.swarm-design-container .empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--color-text-secondary);
}

.swarm-design-container .empty-state p {
    margin: 0;
    font-size: var(--font-size-base);
    font-style: italic;
}

/* Notification Container */
.swarm-design-container .notification-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-base);
    background: var(--color-warning-light);
    border-radius: var(--border-radius-base);
    border: 1px solid var(--color-warning-border);
    border-left: 4px solid var(--color-warning);
    margin-top: var(--spacing-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    width: 100%;
    box-sizing: border-box;
}

.swarm-design-container .notification-container span {
    color: var(--color-text-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-bg-tertiary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border-primary);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .swarm-design-container .two-column-layout {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-lg) !important;
    }
}

@media (max-width: 768px) {
    .swarm-design-container {
        padding: var(--spacing-base) !important;
    }

    .swarm-design-container .top-button-bar {
        flex-direction: column;
        gap: var(--spacing-sm);
        padding: var(--spacing-base);
    }

    .swarm-design-container .top-btn {
        width: 100%;
    }

    .swarm-design-container .left-column,
    .swarm-design-container .right-column,
    .swarm-design-container .plots-section {
        padding: var(--spacing-base);
    }

    .swarm-design-container .drone-list {
        max-height: 400px;
    }

    .swarm-design-container .graph-view {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .swarm-design-container {
        padding: var(--spacing-sm) !important;
    }

    .swarm-design-container .top-button-bar,
    .swarm-design-container .left-column,
    .swarm-design-container .right-column,
    .swarm-design-container .plots-section {
        padding: var(--spacing-sm);
    }

    .swarm-design-container .top-btn {
        font-size: var(--font-size-sm);
        padding: var(--spacing-sm);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .swarm-design-container .top-btn {
        transition: none;
    }
}

/* Focus states for accessibility */
.swarm-design-container .top-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .swarm-design-container .left-column,
    .swarm-design-container .right-column,
    .swarm-design-container .plots-section,
    .swarm-design-container .top-button-bar {
        border-width: 2px;
    }

    .swarm-design-container .top-btn {
        border: 1px solid var(--color-border-primary);
    }
}