body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    margin: 0;
    padding: 0;
}

/* Background container styling */
.ml-background {
    background: radial-gradient(1200px 600px at 20% -10%, rgba(102, 126, 234, 0.25), transparent 60%),
                radial-gradient(1000px 500px at 90% 0%, rgba(118, 75, 162, 0.25), transparent 60%),
                linear-gradient(135deg, #e9eff5 0%, #dbe2ef 100%);
    min-height: 100vh;
    padding: 24px;
}

/* Navbar styling */
.ml-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 18px;
    padding: 14px 18px;
    box-shadow: 0 10px 25px rgba(76, 110, 245, 0.18), inset 0 1px 0 rgba(255,255,255,0.2);
    max-width: 1200px;
    margin: 0 auto 20px;
}

.ml-nav-left {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ml-navbar-title {
    color: #1b1b1d;
    font-weight: 800;
    font-size: 1.8rem;
}

/* Content styling */
h1 {
    color: #2c3e50;
    text-align: center;
    margin-top: 40px;
}

#ml-content {
    margin: 24px auto;
    width: min(1200px, 95%);
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

/* Hide regression controls when in gradient-descent mode */
#ml-content.mode-gd .controls { display: none; }

.ml-toolbar { 
    width: min(1200px, 95%);
    margin: 0 auto 10px;
    display: none; /* hidden by default */
    justify-content: flex-end;
}
.ml-toolbar.show { display: flex; }
.ml-toolbar .ml-toolbar-item { 
    display: flex; align-items: center; gap: 6px; margin-right: 10px; 
    font-size: 12px; color: #333; 
}
.ml-toolbar input { 
    font-size: 12px; padding: 4px 6px; border-radius: 6px; border: 1px solid #d0d5dd; width: 90px; 
}
.ml-toolbar select { 
    font-size: 12px; padding: 4px 6px; border-radius: 6px; border: 1px solid #d0d5dd; 
}
.gd-status { margin-left: 12px; font-size: 12px; color: #2c7a7b; font-weight: 600; }

/* Compact gradient descent toolbar */
.ml-toolbar.gd-compact { display: none; justify-content: space-between; gap: 12px; padding: 10px; align-items: center; }
.ml-toolbar.gd-compact.show { display: flex; }
.gd-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gd-controls label { font-size: 13px; display: flex; align-items: center; gap:6px; }
.gd-controls input[type=number], .gd-controls select, .gd-custom input { width: 100px; padding:6px 8px; font-size:13px; }
.gd-inline { display: inline-flex; align-items: center; gap:6px; font-size:13px; }
.gd-buttons { display:flex; gap:8px; align-items:center; }
.ml-btn-quiet { background: #f1f5f9; color: #374151; box-shadow:none; border:1px solid #e2e8f0; }
.ml-btn-ghost { background: transparent; color: #374151; box-shadow:none; border:1px dashed #e2e8f0; }
.ml-explain.compact { font-size:12px; color:#334155; max-width:360px; }
.gd-side { display:flex; flex-direction:column; gap:8px; align-items:flex-end; }
.gd-custom { display:flex; gap:8px; align-items:center; }

/* Responsive: stack on small screens */
@media (max-width: 880px) {
    .ml-toolbar.gd-compact.show { flex-direction: column; align-items: stretch; }
    .gd-side { align-items: stretch; }
    .gd-controls { justify-content: space-between; }
    .gd-controls input[type=number], .gd-controls select, .gd-custom input { width: 48%; }
}

/* Panel layout: big plot, compact controls */
.panel { display: grid; grid-template-columns: 1fr; gap: 16px; }
.plot-area { height: 520px; width: 100%; }
.controls { display: grid; gap: 8px; }
.controls-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.controls-row.full { flex-direction: column; align-items: stretch; }
.controls label { font-size: 12px; color: #444; display: flex; gap: 6px; align-items: center; }
.controls input, .controls select { font-size: 12px; padding: 4px 6px; border-radius: 6px; border: 1px solid #d0d5dd; }
.controls textarea { font-size: 12px; padding: 6px 8px; border-radius: 8px; border: 1px solid #d0d5dd; width: 100%; }
.controls .ml-btn { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.manual-row { display: none; }
.manual-row.show { display: flex; }
.manual-row input { min-width: 360px; }

/* Button styling */
.ml-btn {
    background: linear-gradient(135deg, #7aa6ff 0%, #8f6bdc 100%);
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: .2px;
    box-shadow: 0 6px 14px rgba(79, 94, 255, 0.35);
    transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}

.ml-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.07);
    box-shadow: 0 10px 20px rgba(79, 94, 255, 0.38);
}

.dropdown {
    position: relative;
}
      
    
.dropdown-toggle {
    background: linear-gradient(135deg, #ffb473 0%, #e67e22 100%);
}
.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    min-width: 240px;
    padding: 8px;
    box-shadow: 0 14px 28px rgba(0,0,0,0.15);
    backdrop-filter: blur(4px);
    z-index: 5;
}
.dropdown-content.show {
    display: block;
}
.dropdown-content .ml-btn {
    background: transparent;
    color: #4c6ef5;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: none;
}
.dropdown-content .ml-btn:hover {
    background: rgba(76,110,245,0.08);
    color: #384bd8;
}

/* Dropdown links for navigation */
.dropdown-link {
    display: block;
    background: transparent;
    color: #4c6ef5;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.dropdown-link:hover {
    background: rgba(76,110,245,0.08);
    color: #384bd8;
    text-decoration: none;
}

/* Premium-locked dropdown styling */
.dropdown-locked .dropdown-toggle-locked {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
    color: #adb5bd !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
    position: relative;
}

.dropdown-locked .dropdown-toggle-locked:hover {
    transform: none !important;
    filter: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

.dropdown-locked .dropdown-toggle-locked::after {
    content: "🔒";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}

/* ML Content Pages */
.ml-content {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.algorithm-description, .tool-description {
    margin-bottom: 30px;
}

.algorithm-description h3, .tool-description h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.algorithm-description p, .tool-description p {
    color: #555;
    line-height: 1.6;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.features-list h4 {
    color: #34495e;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.features-list ul {
    list-style-type: disc;
    padding-left: 20px;
}

.features-list li {
    margin-bottom: 5px;
    color: #555;
}

.algorithm-controls, .tool-controls {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.control-section h4, .control-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.parameter-controls, .tool-config {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.algorithm-visualization, .tool-visualization {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.algorithm-info, .tool-info {
    margin-top: 30px;
}

.info-panel {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.info-panel h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.info-panel p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
}

.coming-soon {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
}

.coming-soon p {
    margin: 0;
    color: #856404;
}
