:root {
    --primary-color: #3b82f6; /* Moderni mėlyna */
    --primary-hover: #2563eb;
    --danger-color: #ef4444;
    --text-main: #1f2937;
    --text-secondary: #6b7280;
    --bg-panel: rgba(255, 255, 255, 0.95);
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    
    /* Toolbar Colors */
    --toolbar-bg: #2d3748;
    --toolbar-text: #e2e8f0;
    --toolbar-hover: #4a5568;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif; /* Modernus fontas */
    background-color: #f3f4f6;
    color: var(--text-main);
    overflow: hidden;
}

/* --- Top Toolbar --- */
#top-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: var(--toolbar-bg);
    color: var(--toolbar-text);
    display: flex;
    align-items: center;
    padding: 0 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 200;
    box-sizing: border-box;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background-color: rgba(255,255,255,0.2);
    margin: 0 10px;
}

.toolbar-spacer {
    flex: 1;
}

.tool-btn {
    background: transparent;
    border: none;
    color: var(--toolbar-text);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.tool-btn:hover, .tool-btn.active {
    background-color: var(--toolbar-hover);
}

.tool-btn.active {
    border-bottom: 2px solid var(--primary-color);
    background-color: rgba(255,255,255,0.1);
}

.tool-btn svg {
    width: 18px;
    height: 18px;
}

.tool-btn span {
    display: none; /* Hide text on small screens if needed, but show for now */
}

@media (min-width: 768px) {
    .tool-btn span {
        display: inline;
    }
}

/* --- Sidebar Panel --- */
#ui-container {
    position: absolute;
    top: 70px; /* Adjusted for toolbar */
    left: 20px;
    width: 340px;
    max-height: calc(100vh - 90px);
    background: var(--bg-panel);
    backdrop-filter: blur(8px);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
    z-index: 100;
}

/* Header */
.panel-header {
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: #111827;
}

.panel-header p {
    margin: 5px 0 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Content Area (Scrollable) */
.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* --- Accordion Sections --- */
.section {
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    padding: 15px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    user-select: none;
}

.section-title:hover {
    background: #f3f4f6;
}

.section-title::after {
    content: '▼';
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.section.active .section-title::after {
    transform: rotate(180deg);
}

.section-body {
    padding: 20px;
    display: none;
    background: #fff;
}

.section.active .section-body {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Forms & Inputs --- */
.control-group {
    margin-bottom: 15px;
}

.control-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-main);
}

input[type="number"],
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.row {
    display: flex;
    gap: 12px;
}

.col {
    flex: 1;
}

/* --- Buttons --- */
.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #10b981; /* Green */
    color: white;
    margin-top: 10px;
}

.btn-secondary:hover {
    background-color: #059669;
}

.btn-icon {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fee2e2;
    color: var(--danger-color);
}

.btn-icon:hover {
    background: var(--danger-color);
    color: white;
}

/* --- Openings List --- */
#openings-list {
    list-style: none;
    padding: 0;
    margin: 15px 0 0 0;
}

#openings-list li {
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.opening-info {
    display: flex;
    flex-direction: column;
}

.opening-tag {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 2px;
}

/* --- BOM Table --- */
#bom-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

#bom-container th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

#bom-container td {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

#bom-container tr:last-child td {
    border-bottom: none;
}

/* --- Footer Action --- */
.panel-footer {
    padding: 20px;
    background: #fff;
    border-top: 1px solid var(--border-color);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}


/* Modal Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.4); 
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto; 
    padding: 25px;
    border: 1px solid #888;
    width: 400px;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.close-modal {
    color: #9ca3af;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #111827;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

/* --- Admin Panel Specifics --- */
#admin-login-view, #admin-dashboard-view {
    transition: opacity 0.3s;
}

.stat-card {
    background: #f3f4f6;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    text-align: center;
}

.stat-card h3 {
    margin: 0;
    font-size: 2rem;
    color: var(--primary-color);
}

.stat-card p {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#stats-table {
    width: 100%;
    margin-top: 15px;
    font-size: 0.8rem;
    border-collapse: collapse;
}

#stats-table th, #stats-table td {
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

/* BOM Modal Specifics */
#bom-container {
    font-size: 0.9rem;
}
#bom-container table th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}